Exemplo n.º 1
0
		public void EnvironmentSetup(IVostokHostingEnvironmentBuilder builder)
		{
			var configurationProvider = new ConfigurationProvider(new ConfigurationProviderSettings());
			var configurationSource = GetConfigurationSource();
			configurationProvider.SetupSourceFor<UlearnConfiguration>(configurationSource);
			var ulearnConfiguration = configurationProvider.Get<UlearnConfiguration>();
			var environment = ulearnConfiguration.Environment ?? "dev";

			if (!ulearnConfiguration.DisableKonturServices)
				builder = builder.SetupForKontur();

			builder.SetupApplicationIdentity(identityBuilder => identityBuilder
					.SetProject("ulearn")
					.SetApplication(application)
					.SetEnvironment(environment)
					.SetInstance(Environment.MachineName.Replace(".", "_").ToLower()))
				.SetupConfiguration(configurationBuilder => configurationBuilder.AddSecretSource(configurationSource));
			if (ulearnConfiguration.Port != null)
				builder.SetPort(ulearnConfiguration.Port.Value);
			if (ulearnConfiguration.BaseUrl != null)
				builder.SetBaseUrlPath(ulearnConfiguration.BaseUrl);
			builder	
				.DisableServiceBeacon()
				.SetupHerculesSink(sinkBuilder => SetupHerculesSink(sinkBuilder, ulearnConfiguration))
				.SetupLog((logBuilder, context) => SetupLog(logBuilder, ulearnConfiguration))
				;

			if (ulearnConfiguration.ForceHttps ?? false)
				builder.SetHttpsScheme();
		}