Exemplo n.º 1
0
        private VostokApplicationRunResult BuildEnvironment()
        {
            ChangeStateTo(VostokApplicationState.EnvironmentSetup);

            try
            {
                var environmentFactorySettings = new VostokHostingEnvironmentFactorySettings
                {
                    ConfigureStaticProviders  = settings.ConfigureStaticProviders,
                    BeaconShutdownTimeout     = settings.BeaconShutdownTimeout,
                    BeaconShutdownWaitEnabled = settings.BeaconShutdownWaitEnabled,
                    SendAnnotations           = settings.SendAnnotations
                };

                environment = EnvironmentBuilder.Build(SetupEnvironment, environmentFactorySettings);

                log = environment.Log.ForContext <VostokHost>();

                return(null);
            }
            catch (Exception error)
            {
                return(ReturnResult(VostokApplicationState.CrashedDuringEnvironmentSetup, error));
            }
        }
 public static IVostokHostingEnvironment Create([NotNull] VostokHostingEnvironmentSetup setup, [NotNull] VostokHostingEnvironmentFactorySettings settings)
 => EnvironmentBuilder.Build(setup ?? throw new ArgumentNullException(nameof(setup)), settings);