Exemple #1
0
        public Startup(IHostingEnvironment env)
        {
            var builder = new ConfigurationBuilder()
                          .SetBasePath(Directory.GetCurrentDirectory())
                          .AddJsonFile(config =>
            {
                config.Path           = "appSettings.json";
                config.ReloadOnChange = true;
            })
                          .AddJsonFile(options =>
            {
                options.Path           = $"appsettings.{env.EnvironmentName}.json";
                options.ReloadOnChange = true;
                options.Optional       = true;
            }
                                       )
                          .AddEnvironmentVariables();

            var configSettings = new AppSettings();

            builder.Build().Bind(configSettings);

            var settingsBuilder = new ConfigurationBuilder()
                                  .AddCustomConfig(configSettings);

            Configuration = settingsBuilder.Build();

            Log.Logger = ApplicationLogging
                         .GetSeriLogger(Configuration.AsEnumerable()
                                        .ToDictionary(x => x.Key, x => x.Value));
            _stsServer = "https://localhost:44364";//Configuration["StsServer"];
        }