Пример #1
0
        public Startup(IWebHostEnvironment env)
        {
            var basePath = AppDomain.CurrentDomain.BaseDirectory;

            var builder = new ConfigurationBuilder()
                          .SetBasePath(basePath)
                          .AddJsonFile($"appsettings.json", optional: true, reloadOnChange: true)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true)
                          .AddEnvironmentVariables();

            Configuration = builder.Build();

            //if (env.IsDevelopment())
            //{
            //    DotNetEnv.Env.Load();
            //}

            SecurityConfig.Init(Configuration);
        }
Пример #2
0
        public Startup(IHostingEnvironment env)
        {
            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Verbose()
                         .Enrich.FromLogContext()
                         .WriteTo.File("Log/Log-.txt", rollingInterval: RollingInterval.Day)
                         .CreateLogger();

            var basePath = AppDomain.CurrentDomain.BaseDirectory; //#SDK 2.00

            var builder = new ConfigurationBuilder()
                          .SetBasePath(basePath)
                          .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true, reloadOnChange: true)
                          .AddEnvironmentVariables();

            Configuration = builder.Build();
            Environment   = env;

            BaseController.StartConfig(); //Leer Config
            SecurityConfig.Init((IConfigurationRoot)Configuration);
        }