fixes nonreg
This commit is contained in:
parent
f0e8451577
commit
f290074149
5 changed files with 54 additions and 87 deletions
|
|
@ -23,8 +23,7 @@ namespace test
|
|||
public static IConfiguration Configuration { get; set; }
|
||||
|
||||
public static string HostingFullName { get; private set; }
|
||||
public static DbConnectionSettings DevDbSettings { get; private set; }
|
||||
public static DbConnectionSettings TestDbSettings { get; private set; }
|
||||
public static DbConnectionSettings DbSettings { get; private set; }
|
||||
|
||||
ILogger logger;
|
||||
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
|
||||
|
|
@ -50,11 +49,8 @@ namespace test
|
|||
services.Configure<SiteSettings>(siteSettingsconf);
|
||||
var smtpSettingsconf = Configuration.GetSection("Smtp");
|
||||
services.Configure<SmtpSettings>(smtpSettingsconf);
|
||||
var devCx = Configuration.GetSection("Data:DevConnection");
|
||||
services.Configure<DevConnectionSettings>(devCx);
|
||||
var testCx = Configuration.GetSection("Data:TestConnection");
|
||||
services.Configure<TestConnectionSettings>(testCx);
|
||||
|
||||
var dbSettingsconf = Configuration.GetSection("ConnectionStrings");
|
||||
services.Configure<DbConnectionSettings>(dbSettingsconf);
|
||||
|
||||
services.AddInstance(typeof(ILoggerFactory), new LoggerFactory());
|
||||
services.AddTransient(typeof(IEmailSender), typeof(MailSender));
|
||||
|
|
@ -70,7 +66,7 @@ namespace test
|
|||
services.AddEntityFramework()
|
||||
.AddNpgsql()
|
||||
.AddDbContext<ApplicationDbContext>(
|
||||
db => db.UseNpgsql(Startup.TestDbSettings.ConnectionString)
|
||||
db => db.UseNpgsql(Startup.DbSettings.Default)
|
||||
);
|
||||
|
||||
services.AddTransient<Microsoft.Extensions.WebEncoders.UrlEncoder, UrlEncoder>();
|
||||
|
|
@ -79,8 +75,7 @@ namespace test
|
|||
|
||||
public void Configure (IApplicationBuilder app, IHostingEnvironment env,
|
||||
IOptions<SiteSettings> siteSettings,
|
||||
IOptions<TestConnectionSettings> testCxOptions,
|
||||
IOptions<DevConnectionSettings> devCxOptions,
|
||||
IOptions<DbConnectionSettings> cxOptions,
|
||||
ILoggerFactory loggerFactory)
|
||||
{
|
||||
loggerFactory.AddConsole(Configuration.GetSection("Logging"));
|
||||
|
|
@ -88,10 +83,10 @@ namespace test
|
|||
logger = loggerFactory.CreateLogger<Startup>();
|
||||
logger.LogInformation(env.EnvironmentName);
|
||||
|
||||
TestDbSettings = testCxOptions.Value;
|
||||
DevDbSettings = devCxOptions.Value;
|
||||
logger.LogInformation($"test db : {TestDbSettings.ConnectionString}");
|
||||
AppDomain.CurrentDomain.SetData("YAVSC_DB_CONNECTION", TestDbSettings.ConnectionString);
|
||||
DbSettings = cxOptions.Value;
|
||||
logger.LogInformation($"default db : {DbSettings.Default}");
|
||||
logger.LogInformation($"test db : {DbSettings.Testing}");
|
||||
AppDomain.CurrentDomain.SetData("YAVSC_DB_CONNECTION", DbSettings.Default);
|
||||
|
||||
var authConf = Configuration.GetSection("Authentication").GetSection("Yavsc");
|
||||
var clientId = authConf.GetSection("ClientId").Value;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue