aboutsummaryrefslogtreecommitdiff
path: root/BackEnd/Timeline
diff options
context:
space:
mode:
Diffstat (limited to 'BackEnd/Timeline')
-rw-r--r--BackEnd/Timeline/Program.cs51
-rw-r--r--BackEnd/Timeline/Properties/launchSettings.json9
2 files changed, 31 insertions, 29 deletions
diff --git a/BackEnd/Timeline/Program.cs b/BackEnd/Timeline/Program.cs
index 87e330a2..1f0f72b9 100644
--- a/BackEnd/Timeline/Program.cs
+++ b/BackEnd/Timeline/Program.cs
@@ -1,5 +1,6 @@
using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using System.Resources;
@@ -10,34 +11,38 @@ using Timeline.Services;
namespace Timeline
{
- public static class Program
+ public static class Program
+ {
+ public static void Main(string[] args)
{
- public static void Main(string[] args)
- {
- var host = CreateWebHostBuilder(args).Build();
-
- var env = host.Services.GetRequiredService<IWebHostEnvironment>();
+ var host = CreateWebHostBuilder(args).Build();
- var databaseBackupService = host.Services.GetRequiredService<IDatabaseBackupService>();
- databaseBackupService.BackupNow();
+ var env = host.Services.GetRequiredService<IWebHostEnvironment>();
- if (env.IsProduction())
- {
- using (var scope = host.Services.CreateScope())
- {
- var databaseContext = scope.ServiceProvider.GetRequiredService<DatabaseContext>();
- databaseContext.Database.Migrate();
- }
- }
+ var databaseBackupService = host.Services.GetRequiredService<IDatabaseBackupService>();
+ databaseBackupService.BackupNow();
- host.Run();
+ if (env.IsProduction())
+ {
+ using (var scope = host.Services.CreateScope())
+ {
+ var databaseContext = scope.ServiceProvider.GetRequiredService<DatabaseContext>();
+ databaseContext.Database.Migrate();
}
+ }
- public static IHostBuilder CreateWebHostBuilder(string[] args) =>
- Host.CreateDefaultBuilder(args)
- .ConfigureWebHostDefaults(webBuilder =>
- {
- webBuilder.UseStartup<Startup>();
- });
+ host.Run();
}
+
+ public static IHostBuilder CreateWebHostBuilder(string[] args) =>
+ Host.CreateDefaultBuilder(args)
+ .ConfigureAppConfiguration(config =>
+ {
+ config.AddEnvironmentVariables("Timeline_");
+ })
+ .ConfigureWebHostDefaults(webBuilder =>
+ {
+ webBuilder.UseStartup<Startup>();
+ });
+ }
}
diff --git a/BackEnd/Timeline/Properties/launchSettings.json b/BackEnd/Timeline/Properties/launchSettings.json
index a31485ed..db58cd31 100644
--- a/BackEnd/Timeline/Properties/launchSettings.json
+++ b/BackEnd/Timeline/Properties/launchSettings.json
@@ -5,23 +5,20 @@
"applicationUrl": "http://0.0.0.0:5000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
- "ASPNETCORE_FRONTEND": "Proxy",
- "ASPNETCORE_WORKDIR": "D:\\timeline-development"
+ "ASPNETCORE_FRONTEND": "Proxy"
}
},
"Dev-Mock": {
"commandName": "Project",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
- "ASPNETCORE_FRONTEND": "Mock",
- "ASPNETCORE_WORKDIR": "D:\\timeline-development"
+ "ASPNETCORE_FRONTEND": "Mock"
}
},
"Staging": {
"commandName": "Project",
"environmentVariables": {
- "ASPNETCORE_ENVIRONMENT": "Staging",
- "ASPNETCORE_WORKDIR": "D:\\timeline-development"
+ "ASPNETCORE_ENVIRONMENT": "Staging"
}
}
}