Put all AYANOVA_SERVER_TEST_MODE stuff in a DEBUG build only block in prep for release
This commit is contained in:
@@ -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)
|
||||
{
|
||||
_newLog.LogWarning("AYANOVA_SERVER_TEST_MODE, dropping and recreating database");
|
||||
}
|
||||
else
|
||||
{
|
||||
_newLog.LogWarning("AYANOVA_PERMANENTLY_ERASE_DATABASE has been set - deleting 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) =>
|
||||
|
||||
@@ -679,9 +679,6 @@ namespace AyaNova.Core
|
||||
{
|
||||
var msg = "E1020 - License key not found in database, running in unlicensed mode";
|
||||
apiServerState.SetSystemLock(msg);
|
||||
if (ServerBootConfig.AYANOVA_SERVER_TEST_MODE)
|
||||
log.LogDebug(msg);
|
||||
else
|
||||
log.LogWarning(msg);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,13 +40,12 @@ namespace AyaNova.Util
|
||||
internal static List<string> TranslationKeysRequested { get; set; }
|
||||
|
||||
#endif
|
||||
|
||||
#if (DEBUG)
|
||||
//TEST MODE - BOOT WILL ERASE DB AND GENERATE SAMPLE DATA EVERY TIME
|
||||
//** Not intended for end users
|
||||
internal static bool AYANOVA_SERVER_TEST_MODE { get; set; }
|
||||
internal static decimal AYANOVA_SERVER_TEST_MODE_TZ_OFFSET { get; set; }
|
||||
internal static string AYANOVA_SERVER_TEST_MODE_SEEDLEVEL { get; set; }
|
||||
|
||||
#endif
|
||||
//CONTENTROOTPATH
|
||||
//** Not intended for end users
|
||||
internal static string AYANOVA_CONTENT_ROOT_PATH { get; set; } //Note: set in startup.cs, not in program.cs as it requires startup IHostingEnvironment
|
||||
@@ -112,7 +111,7 @@ namespace AyaNova.Util
|
||||
|
||||
#region SERVER BASICS
|
||||
|
||||
//TEST MODE?
|
||||
#if (DEBUG)
|
||||
bTemp = config.GetValue<bool?>("AYANOVA_SERVER_TEST_MODE");
|
||||
AYANOVA_SERVER_TEST_MODE = (null == bTemp) ? false : (bool)bTemp;
|
||||
AYANOVA_SERVER_TEST_MODE_SEEDLEVEL = config.GetValue<string>("AYANOVA_SERVER_TEST_MODE_SEEDLEVEL");
|
||||
@@ -120,6 +119,7 @@ namespace AyaNova.Util
|
||||
decimal? dTemp = config.GetValue<decimal?>("AYANOVA_SERVER_TEST_MODE_TZ_OFFSET");
|
||||
AYANOVA_SERVER_TEST_MODE_TZ_OFFSET = (null == dTemp) ? 0 : (decimal)dTemp;
|
||||
|
||||
#endif
|
||||
//LANGUAGE
|
||||
//TranslationBiz will validate this later at boot pfc and ensure a sane default is set (English)
|
||||
AYANOVA_DEFAULT_TRANSLATION = config.GetValue<string>("AYANOVA_DEFAULT_TRANSLATION");
|
||||
|
||||
Reference in New Issue
Block a user