This commit is contained in:
2020-06-23 18:45:06 +00:00
parent 12fbe66bd9
commit 6d2c7b14ce
3 changed files with 14 additions and 7 deletions

2
.vscode/launch.json vendored
View File

@@ -45,7 +45,7 @@
//"AYANOVA_LOG_LEVEL": "Debug", //"AYANOVA_LOG_LEVEL": "Debug",
"AYANOVA_DEFAULT_TRANSLATION": "en", "AYANOVA_DEFAULT_TRANSLATION": "en",
//TRANSLATION MUST BE en for Integration TESTING //TRANSLATION MUST BE en for Integration TESTING
"AYANOVA_PERMANENTLY_ERASE_DATABASE": "true", //"AYANOVA_PERMANENTLY_ERASE_DATABASE": "true",
"AYANOVA_DB_CONNECTION": "Server=localhost;Username=postgres;Password=raven;Database=AyaNova;", "AYANOVA_DB_CONNECTION": "Server=localhost;Username=postgres;Password=raven;Database=AyaNova;",
"AYANOVA_USE_URLS": "http://*:7575;", "AYANOVA_USE_URLS": "http://*:7575;",
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",

View File

@@ -7,7 +7,7 @@ namespace AyaNova.Models
{ {
public RequestTrial() public RequestTrial()
{ {
DbId = string.Empty;//default this because it's coming from the client without a dbid as the server will set it before forwarding it on DbId = "-";//default this because it's coming from the client without a dbid as the server will set it before forwarding it on
} }
[Required] [Required]
public string DbId { get; set; } public string DbId { get; set; }

View File

@@ -481,6 +481,10 @@ namespace AyaNova.Core
#region License fetching and handling #region License fetching and handling
public class dtoFetchRequest
{
public string DbId { get; set; }
}
/// <summary> /// <summary>
/// Fetch a key, validate it and install it in the db then initialize with it /// Fetch a key, validate it and install it in the db then initialize with it
@@ -493,12 +497,15 @@ namespace AyaNova.Core
else else
log.LogInformation($"Fetching license for DBID {LicenseDbId}"); log.LogInformation($"Fetching license for DBID {LicenseDbId}");
string sUrl = $"{LICENSE_SERVER_URL}rvf/{LicenseDbId}"; var FetchRequest=new dtoFetchRequest(){DbId=LicenseDbId};
string sUrl = $"{LICENSE_SERVER_URL}rvf";
try try
{ {
// string ResponseText = await ServiceProviderProvider.HttpClientFactory.CreateClient().GetStringAsync(sUrl); // string ResponseText = await ServiceProviderProvider.HttpClientFactory.CreateClient().GetStringAsync(sUrl);
var content = new StringContent(JsonConvert.SerializeObject(FetchRequest), Encoding.UTF8, "application/json");
var client = ServiceProviderProvider.HttpClientFactory.CreateClient(); var client = ServiceProviderProvider.HttpClientFactory.CreateClient();
var res = await client.GetAsync(sUrl); var res = await client.PostAsync(sUrl, content);
if (res.IsSuccessStatusCode) if (res.IsSuccessStatusCode)
{ {
var responseText = await res.Content.ReadAsStringAsync(); var responseText = await res.Content.ReadAsStringAsync();
@@ -580,7 +587,7 @@ namespace AyaNova.Core
//First fetch the schema db id for the servers database, the license must match //First fetch the schema db id for the servers database, the license must match
var schema = await ct.SchemaVersion.AsNoTracking().SingleOrDefaultAsync(); var schema = await ct.SchemaVersion.AsNoTracking().SingleOrDefaultAsync();
//if (schema == null || schema.Id == Guid.Empty) //if (schema == null || schema.Id == Guid.Empty)
if (schema == null || string.IsNullOrWhiteSpace(schema.Id) ) if (schema == null || string.IsNullOrWhiteSpace(schema.Id))
{ {
//cryptic message deliberately, this is probably caused by someone trying to circumvent licensing //cryptic message deliberately, this is probably caused by someone trying to circumvent licensing
var msg = "E1030 - Database integrity check failed (2). Contact support."; var msg = "E1030 - Database integrity check failed (2). Contact support.";
@@ -604,8 +611,8 @@ namespace AyaNova.Core
} }
//ensure DB ID //ensure DB ID
// if (ldb.DbId == Guid.Empty) // if (ldb.DbId == Guid.Empty)
if (string.IsNullOrWhiteSpace(ldb.DbId )) if (string.IsNullOrWhiteSpace(ldb.DbId))
{ {
ldb.DbId = ServerDbId; ldb.DbId = ServerDbId;
//Convert the no tracking record fetched above to tracking //Convert the no tracking record fetched above to tracking