Esempio n. 1
0
        public Startup(IHostingEnvironment env)
        {
            // Setup configuration sources.
            var builder = new ConfigurationBuilder()
                .SetBasePath(env.ContentRootPath)
                .AddJsonFile("version.json")
                .AddJsonFile("config.json")
                .AddJsonFile($"config.{env.EnvironmentName}.json", optional: true)
                .AddEnvironmentVariables();

            if (env.IsDevelopment())
            {
                // This reads the configuration keys from the secret store.
                // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709
                builder.AddUserSecrets();

                // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
                builder.AddApplicationInsightsSettings(developerMode: true);
            }
            else if (env.IsStaging() || env.IsProduction())
            {
                // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately.
                builder.AddApplicationInsightsSettings(developerMode: false);
            }

            Configuration = builder.Build();

            Configuration["version"] = new ApplicationEnvironment().ApplicationVersion; // version in project.json
        }
Esempio n. 2
0
 public ServiceConfig()
 {
     Microsoft.Extensions.PlatformAbstractions.ApplicationEnvironment env = PlatformServices.Default.Application;
     ServiceName = env.ApplicationName;
     ServiceId   = ServiceName + Guid.NewGuid();
 }
 public DefaultEnvironmentServices()
 {
     Application = new ApplicationEnvironment();
     Runtime = new RuntimeEnvironment();
 }
 public static string GetServiceTypeName(ApplicationEnvironment appEnv)
 {
     return string.Format("{0}Type", appEnv.ApplicationName);
 }
 public DocumentationFiles(ApplicationEnvironment applicationEnvironment)
 {
     if (applicationEnvironment == null) throw new ArgumentNullException(nameof(applicationEnvironment));
     _applicationEnvironment = applicationEnvironment;
 }