Put all AYANOVA_SERVER_TEST_MODE stuff in a DEBUG build only block in prep for release

This commit is contained in:
2022-01-05 19:39:54 +00:00
parent c744cf1af0
commit 81f23420e6
3 changed files with 20 additions and 28 deletions

View File

@@ -533,21 +533,22 @@ namespace AyaNova
if (ServerBootConfig.AYANOVA_PERMANENTLY_ERASE_DATABASE || ServerBootConfig.AYANOVA_SERVER_TEST_MODE)
#if (DEBUG)
if (ServerBootConfig.AYANOVA_SERVER_TEST_MODE)
{
if (ServerBootConfig.AYANOVA_SERVER_TEST_MODE)
{
_newLog.LogWarning("AYANOVA_SERVER_TEST_MODE, dropping and recreating database");
}
else
{
_newLog.LogWarning("AYANOVA_PERMANENTLY_ERASE_DATABASE has been set - deleting and recreating database");
}
_newLog.LogWarning("AYANOVA_SERVER_TEST_MODE, dropping and recreating database");
Util.DbUtil.DropAndRecreateDbAsync(_newLog).Wait();
AySchema.CheckAndUpdateAsync(dbContext, _newLog).Wait();
}
else
#endif
if (ServerBootConfig.AYANOVA_PERMANENTLY_ERASE_DATABASE)
{
_newLog.LogWarning("AYANOVA_PERMANENTLY_ERASE_DATABASE has been set - deleting and recreating database");
Util.DbUtil.DropAndRecreateDbAsync(_newLog).Wait();
AySchema.CheckAndUpdateAsync(dbContext, _newLog).Wait();
}
var dbServerVersionInfo = DbUtil.DBServerVersion(dbContext);
var dbServerRunTimeParameters = DbUtil.DBServerRunTimeParameters(dbContext);
@@ -599,21 +600,15 @@ namespace AyaNova
TranslationBiz lb = new TranslationBiz(dbContext, 1, ServerBootConfig.AYANOVA_DEFAULT_TRANSLATION_ID, AuthorizationRoles.OpsAdmin);
lb.ValidateTranslationsAsync().Wait();
//TESTING
#if (DEBUG)
if (ServerBootConfig.AYANOVA_SERVER_TEST_MODE)
{
_newLog.LogInformation($"Server test mode seeding, level is {ServerBootConfig.AYANOVA_SERVER_TEST_MODE_SEEDLEVEL}, tz offset is {ServerBootConfig.AYANOVA_SERVER_TEST_MODE_TZ_OFFSET}");
#if (DEBUG)
AyaNova.Core.License.FetchKeyAsync(apiServerState, dbContext, _newLog, true, true).Wait();
#else
AyaNova.Core.License.FetchKeyAsync(apiServerState, dbContext, _newLog, true).Wait();
#endif
var seed = new Util.Seeder();
seed.SeedDatabaseAsync(Seeder.Level.StringToSeedLevel(ServerBootConfig.AYANOVA_SERVER_TEST_MODE_SEEDLEVEL), ServerBootConfig.AYANOVA_SERVER_TEST_MODE_TZ_OFFSET).Wait();
}
//TESTING
#endif
//SPA FALLBACK ROUTE
app.Use(async (context, next) =>