Setting default environement to debug if configuration is

This commit is contained in:
Zoe Roux 2021-03-04 23:25:56 +01:00
parent 44323f42e7
commit b86a977262

View File

@ -17,7 +17,7 @@ namespace Kyoo
File.Copy(Path.Join(AppDomain.CurrentDomain.BaseDirectory, "appsettings.json"), "appsettings.json");
bool? debug = Environment.GetEnvironmentVariable("ENVIRONEMENT")?.ToLowerInvariant() switch
bool? debug = Environment.GetEnvironmentVariable("ENVIRONMENT")?.ToLowerInvariant() switch
{
"d" => true,
"dev" => true,
@ -29,8 +29,11 @@ namespace Kyoo
_ => null
};
if (debug == null)
Console.WriteLine($"Invalid ENVIRONEMENT variable. Supported values are \"debug\" and \"prod\". Ignoring...");
if (debug == null && Environment.GetEnvironmentVariable("ENVIRONMENT") != null)
Console.WriteLine($"Invalid ENVIRONMENT variable. Supported values are \"debug\" and \"prod\". Ignoring...");
#if DEBUG
debug ??= true;
#endif
Console.WriteLine($"Running as {Environment.UserName}.");
IWebHostBuilder host = CreateWebHostBuilder(args);