This commit is contained in:
2020-07-10 17:33:24 +00:00
parent b5ee22da1d
commit bc1c5fcc7b
4 changed files with 24 additions and 15 deletions

2
.vscode/launch.json vendored
View File

@@ -50,7 +50,7 @@
"AYANOVA_USE_URLS": "http://*:7575;",
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_SERVER_TEST_MODE":"false",
"AYANOVA_SERVER_TEST_MODE":"true",
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL":"small",
"AYANOVA_SERVER_TEST_MODE_TZ_OFFSET":"-7",
"AYANOVA_BACKUP_PG_DUMP_PATH":"C:\\data\\code\\PostgreSQLPortable_12.0\\App\\PgSQL\\bin\\"

View File

@@ -63,7 +63,7 @@ namespace AyaNova.Api.Controllers
if (serverState.IsClosed)
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
System.Random rnd = new System.Random();
int RandomNewCount = rnd.Next(20);
return Ok(ApiOkResponse.Response(RandomNewCount));
}

View File

@@ -547,10 +547,7 @@ namespace AyaNova
_newLog.LogDebug("DB schema check");
AySchema.CheckAndUpdateAsync(dbContext, _newLog).Wait();
// #if (DEBUG)
// System.Diagnostics.Debugger.Log(1, "BOOT", "Startup.cs -> RE-PRIMING TRANSLATIONS");
// AyaNova.Biz.PrimeData.RePrimeTranslations().Wait();
// #endif
//Check database integrity
_newLog.LogDebug("DB integrity check");
@@ -575,7 +572,7 @@ namespace AyaNova
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}");
AyaNova.Core.License.FetchKeyAsync(apiServerState, dbContext, _newLog, true).Wait();
AyaNova.Core.License.FetchKeyAsync(apiServerState, dbContext, _newLog, true, true).Wait();
//NOTE: For unit testing make sure the time zone is same as tester to ensure list filter by date tests will work because server is on same page as user in terms of time
var seed = new Util.Seeder();
seed.SeedDatabaseAsync(Seeder.Level.StringToSeedLevel(ServerBootConfig.AYANOVA_SERVER_TEST_MODE_SEEDLEVEL), ServerBootConfig.AYANOVA_SERVER_TEST_MODE_TZ_OFFSET).Wait();

View File

@@ -29,14 +29,13 @@ namespace AyaNova.Core
{
//License server address
private const string LICENSE_SERVER_URL = "https://rockfish.ayanova.com/";
// private const string LICENSE_SERVER_URL = "https://rockfish.ayanova.com/";
// #if (DEBUG)
//IF TESTING LOCAL DEV ROCKFISH:
// private const string LICENSE_SERVER_URL = "http://localhost:3001/";
// #else
// private const string LICENSE_SERVER_URL = "https://rockfish.ayanova.com/";
// #endif
#if (DEBUG)
private const string LICENSE_SERVER_URL = "http://localhost:3001/";
#else
private const string LICENSE_SERVER_URL = "https://rockfish.ayanova.com/";
#endif
//Unlicensed token
private const string UNLICENSED_TOKEN = "UNLICENSED";
@@ -492,7 +491,11 @@ namespace AyaNova.Core
/// Fetch a key, validate it and install it in the db then initialize with it
/// </summary>
/// <returns>Result string</returns>
#if (DEBUG)
internal static async Task<string> FetchKeyAsync(AyaNova.Api.ControllerHelpers.ApiServerState apiServerState, AyContext ct, ILogger log, bool calledFromInternalJob, bool devTestTrial=false)
#else
internal static async Task<string> FetchKeyAsync(AyaNova.Api.ControllerHelpers.ApiServerState apiServerState, AyContext ct, ILogger log, bool calledFromInternalJob)
#endif
{
if (calledFromInternalJob)
log.LogTrace($"Fetching license for DBID {LicenseDbId} (called by job)");
@@ -500,7 +503,16 @@ namespace AyaNova.Core
log.LogInformation($"Fetching license for DBID {LicenseDbId}");
var FetchRequest = new dtoFetchRequest() { DbId = LicenseDbId };
#if (DEBUG)
string sUrl = $"{LICENSE_SERVER_URL}rvf";
if (devTestTrial)
{
sUrl += "?dtt=true";//signal to rockfish to provide a key immediately for dev testing
}
#else
string sUrl = $"{LICENSE_SERVER_URL}rvf";
#endif
try
{
// string ResponseText = await ServiceProviderProvider.HttpClientFactory.CreateClient().GetStringAsync(sUrl);