case 4170
This commit is contained in:
@@ -577,6 +577,8 @@ namespace AyaNova
|
|||||||
AySchema.CheckAndUpdateAsync(dbContext, _newLog).Wait();
|
AySchema.CheckAndUpdateAsync(dbContext, _newLog).Wait();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var dbServerVersionInfo = DbUtil.DBServerVersion(dbContext);
|
var dbServerVersionInfo = DbUtil.DBServerVersion(dbContext);
|
||||||
var dbServerRunTimeParameters = DbUtil.DBServerRunTimeParameters(dbContext);
|
var dbServerRunTimeParameters = DbUtil.DBServerRunTimeParameters(dbContext);
|
||||||
//Log server version
|
//Log server version
|
||||||
@@ -585,12 +587,19 @@ namespace AyaNova
|
|||||||
//db server extended parameters
|
//db server extended parameters
|
||||||
_newLog.LogTrace($"Database server runtime parameters{Environment.NewLine}{string.Join(Environment.NewLine, dbServerRunTimeParameters)}");
|
_newLog.LogTrace($"Database server runtime parameters{Environment.NewLine}{string.Join(Environment.NewLine, dbServerRunTimeParameters)}");
|
||||||
|
|
||||||
|
//log each item individually from runtime parameters
|
||||||
ServerBootConfig.DBSERVER_DIAGNOSTIC_INFO.Add("DB SERVER", dbServerVersionInfo);
|
ServerBootConfig.DBSERVER_DIAGNOSTIC_INFO.Add("DB SERVER", dbServerVersionInfo);
|
||||||
foreach (var p in dbServerRunTimeParameters)
|
foreach (var p in dbServerRunTimeParameters)
|
||||||
ServerBootConfig.DBSERVER_DIAGNOSTIC_INFO.Add(p.Key, p.Value);
|
ServerBootConfig.DBSERVER_DIAGNOSTIC_INFO.Add(p.Key, p.Value);
|
||||||
|
|
||||||
|
|
||||||
//log each item individually from runtime parameters
|
|
||||||
|
//case 4170
|
||||||
|
if (ServerBootConfig.AYANOVA_REMOVE_LICENSE_FROM_DB)
|
||||||
|
{
|
||||||
|
_newLog.LogWarning("AYANOVA_REMOVE_LICENSE_FROM_DB has been set - removing license from database");
|
||||||
|
Util.DbUtil.RemoveLicenseFromDB(_newLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//Initialize license unless it doesn't exist yet then wait and do it after schema update and fingerprint
|
//Initialize license unless it doesn't exist yet then wait and do it after schema update and fingerprint
|
||||||
|
|||||||
@@ -302,11 +302,48 @@ namespace AyaNova.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//case 4170
|
||||||
|
///////////////////////////////////////////
|
||||||
|
// Remove license key from database
|
||||||
|
// triggered by AYANOVA_REMOVE_LICENSE_FROM_DB flag on boot
|
||||||
|
// This is for potential edge cases when we need
|
||||||
|
// to fix a weird license issue for a customer remotely
|
||||||
|
// by issuing a new license when they can't boot due to a bad license
|
||||||
|
// e.g. they upgrade and no maint so get too new error on boot
|
||||||
|
// want to renew and keep working so they contact us, buy a maintenance
|
||||||
|
// and need to have it fetch. (or some other unknown future issue)
|
||||||
|
//
|
||||||
|
internal static void RemoveLicenseFromDB(ILogger _log)
|
||||||
|
{
|
||||||
|
_log.LogInformation("Removing license from database \"{0}\"", _dbName);
|
||||||
|
|
||||||
|
//clear all connections so that the database can be dropped
|
||||||
|
Npgsql.NpgsqlConnection.ClearAllPools();
|
||||||
|
|
||||||
|
using (var conn = new Npgsql.NpgsqlConnection(_dbConnectionString))
|
||||||
|
{
|
||||||
|
conn.Open();
|
||||||
|
|
||||||
|
// Create the database desired
|
||||||
|
using (var cmd = new Npgsql.NpgsqlCommand())
|
||||||
|
{
|
||||||
|
cmd.Connection = conn;
|
||||||
|
cmd.CommandText = "delete from alicense;";
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
_log.LogDebug("License removed");
|
||||||
|
}
|
||||||
|
conn.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////
|
||||||
// Erase all user entered data from the db
|
// Erase all user entered data from the db
|
||||||
// This is called by seeder for trial seeding purposes
|
// This is called by seeder for trial seeding purposes
|
||||||
// and by v8 migrate and by license controller when erasing db
|
// and by v8 migrate and by license controller when erasing db
|
||||||
internal static async Task EmptyBizDataFromDatabaseForSeedingOrImportingAsync(ILogger _log, Guid jobIdToKeep, bool isMigrate=false)
|
internal static async Task EmptyBizDataFromDatabaseForSeedingOrImportingAsync(ILogger _log, Guid jobIdToKeep, bool isMigrate = false)
|
||||||
{
|
{
|
||||||
|
|
||||||
bool forSeeding = jobIdToKeep != Guid.Empty;
|
bool forSeeding = jobIdToKeep != Guid.Empty;
|
||||||
|
|||||||
@@ -62,13 +62,17 @@ namespace AyaNova.Util
|
|||||||
internal static string AYANOVA_JWT_SECRET { get; set; }
|
internal static string AYANOVA_JWT_SECRET { get; set; }
|
||||||
internal static string AYANOVA_USE_URLS { get; set; }
|
internal static string AYANOVA_USE_URLS { get; set; }
|
||||||
internal static int AYANOVA_REPORT_RENDERING_TIMEOUT { get; set; }
|
internal static int AYANOVA_REPORT_RENDERING_TIMEOUT { get; set; }
|
||||||
|
|
||||||
|
|
||||||
//DATABASE
|
//DATABASE
|
||||||
internal static string AYANOVA_DB_CONNECTION { get; set; }
|
internal static string AYANOVA_DB_CONNECTION { get; set; }
|
||||||
//** Not intended for end users
|
//** Not intended for end users
|
||||||
internal static bool AYANOVA_PERMANENTLY_ERASE_DATABASE { get; set; }
|
internal static bool AYANOVA_PERMANENTLY_ERASE_DATABASE { get; set; }
|
||||||
|
|
||||||
|
//LICENSE EMERGENCY ISSUE GIVES US OPTIONS TO ALLOW BOOT WITHOUT ERASING DATA SO WE CAN ISSUE THEM A REPLACEMENT LICENSE
|
||||||
|
//case 4170
|
||||||
|
internal static bool AYANOVA_REMOVE_LICENSE_FROM_DB { get; set; }
|
||||||
|
|
||||||
//FILE FOLDERS
|
//FILE FOLDERS
|
||||||
internal static string AYANOVA_ATTACHMENT_FILES_PATH { get; set; }
|
internal static string AYANOVA_ATTACHMENT_FILES_PATH { get; set; }
|
||||||
internal static string AYANOVA_BACKUP_FILES_PATH { get; set; }
|
internal static string AYANOVA_BACKUP_FILES_PATH { get; set; }
|
||||||
@@ -81,7 +85,7 @@ namespace AyaNova.Util
|
|||||||
internal static string AYANOVA_REPORT_RENDER_BROWSER_PATH { get; set; }
|
internal static string AYANOVA_REPORT_RENDER_BROWSER_PATH { get; set; }
|
||||||
//REPORT RENDERING BROWSER PARAMS
|
//REPORT RENDERING BROWSER PARAMS
|
||||||
internal static string AYANOVA_REPORT_RENDER_BROWSER_PARAMS { get; set; }
|
internal static string AYANOVA_REPORT_RENDER_BROWSER_PARAMS { get; set; }
|
||||||
|
|
||||||
|
|
||||||
//LOGGING
|
//LOGGING
|
||||||
internal static string AYANOVA_LOG_PATH { get; set; }
|
internal static string AYANOVA_LOG_PATH { get; set; }
|
||||||
@@ -175,23 +179,28 @@ namespace AyaNova.Util
|
|||||||
//REPORT RENDERING
|
//REPORT RENDERING
|
||||||
|
|
||||||
//RENDER ENGINE PATH
|
//RENDER ENGINE PATH
|
||||||
AYANOVA_REPORT_RENDER_BROWSER_PATH = ActualFullPath(config.GetValue<string>("AYANOVA_REPORT_RENDER_BROWSER_PATH"));
|
AYANOVA_REPORT_RENDER_BROWSER_PATH = ActualFullPath(config.GetValue<string>("AYANOVA_REPORT_RENDER_BROWSER_PATH"));
|
||||||
|
|
||||||
//RENDER ENGINE PARAMS
|
//RENDER ENGINE PARAMS
|
||||||
AYANOVA_REPORT_RENDER_BROWSER_PARAMS = config.GetValue<string>("AYANOVA_REPORT_RENDER_BROWSER_PARAMS");
|
AYANOVA_REPORT_RENDER_BROWSER_PARAMS = config.GetValue<string>("AYANOVA_REPORT_RENDER_BROWSER_PARAMS");
|
||||||
|
|
||||||
//PROCESS CONTROL
|
//PROCESS CONTROL
|
||||||
int? nTemp = config.GetValue<int?>("AYANOVA_REPORT_RENDERING_TIMEOUT");
|
int? nTemp = config.GetValue<int?>("AYANOVA_REPORT_RENDERING_TIMEOUT");
|
||||||
AYANOVA_REPORT_RENDERING_TIMEOUT = (null == nTemp) ? 5 : (int)nTemp;//default
|
AYANOVA_REPORT_RENDERING_TIMEOUT = (null == nTemp) ? 5 : (int)nTemp;//default
|
||||||
if (AYANOVA_REPORT_RENDERING_TIMEOUT < 1) AYANOVA_REPORT_RENDERING_TIMEOUT = 1; //one minute minimum timeout
|
if (AYANOVA_REPORT_RENDERING_TIMEOUT < 1) AYANOVA_REPORT_RENDERING_TIMEOUT = 1; //one minute minimum timeout
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//DB
|
//DB
|
||||||
AYANOVA_DB_CONNECTION = config.GetValue<string>("AYANOVA_DB_CONNECTION");
|
AYANOVA_DB_CONNECTION = config.GetValue<string>("AYANOVA_DB_CONNECTION");
|
||||||
bTemp = config.GetValue<bool?>("AYANOVA_PERMANENTLY_ERASE_DATABASE");
|
bTemp = config.GetValue<bool?>("AYANOVA_PERMANENTLY_ERASE_DATABASE");
|
||||||
AYANOVA_PERMANENTLY_ERASE_DATABASE = (null == bTemp) ? false : (bool)bTemp;
|
AYANOVA_PERMANENTLY_ERASE_DATABASE = (null == bTemp) ? false : (bool)bTemp;
|
||||||
|
|
||||||
|
//LICENSE REMOVER
|
||||||
|
//case 4170
|
||||||
|
bTemp = config.GetValue<bool?>("AYANOVA_REMOVE_LICENSE_FROM_DB");
|
||||||
|
AYANOVA_REMOVE_LICENSE_FROM_DB = (null == bTemp) ? false : (bool)bTemp;
|
||||||
|
|
||||||
|
|
||||||
//FOLDERS
|
//FOLDERS
|
||||||
string DataFolderPath = ActualFullPath(config.GetValue<string>("AYANOVA_DATA_PATH"));
|
string DataFolderPath = ActualFullPath(config.GetValue<string>("AYANOVA_DATA_PATH"));
|
||||||
|
|||||||
Reference in New Issue
Block a user