This commit is contained in:
2021-11-26 20:08:04 +00:00
parent 590e0a1b58
commit b6deb38cae
4 changed files with 26 additions and 24 deletions

6
.vscode/launch.json vendored
View File

@@ -52,9 +52,9 @@
// "AYANOVA_USE_URLS": "http://*:7575;",
// //"AYANOVA_REPORT_RENDERING_TIMEOUT": "20000",
// //"AYANOVA_REPORT_RENDERING_MAX_INSTANCES": "3",
// "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
// "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
// "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
"AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles",
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
// "AYANOVA_SERVER_TEST_MODE": "false",
// "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
// "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8",

View File

@@ -66,16 +66,18 @@ namespace AyaNova
return;
}
try
{
FileUtil.EnsureUserAndUtilityFoldersExistAndAreNotIdentical();
}
catch (Exception ex)
{
Console.WriteLine($"Unable to locate or create server file folders error was: {ex.Message}");
return;
}
// "AYANOVA_FOLDER_USER_FILES":"%programdata\\ayanova\\userfiles",
// "":"%programdata\\ayanova\\backupfiles",
// "AYANOVA_LOG_LEVEL": "Info",
// "AYANOVA_LOG_PATH":"%programdata\\ayanova\\"
//Human readable config output to console for diagnosis in case server wont' start
var AyaNovaConfig = config.AsEnumerable().Where(z => z.Key.StartsWith("AYANOVA") && z.Key != "AYANOVA_JWT_SECRET" && z.Key != "AYANOVA_SET_SUPERUSER_PW").Select(z => z.Key + "=" + z.Value).ToList();
var DiagConfig = string.Join(",", AyaNovaConfig);
DiagConfig = DbUtil.PasswordRedactedConnectionString(DiagConfig);
@@ -87,6 +89,8 @@ namespace AyaNova
#region Initialize Logging
//NOTE: there is a logging issue that breaks all this with .net 3.1 hostbuilder vs webhostbuilder but webhostbuilder will be deprecated so we need to work around it
//the discussion about that is here: https://github.com/aspnet/AspNetCore/issues/9337

View File

@@ -117,8 +117,7 @@ namespace AyaNova
_newLog.LogDebug("Ensuring user and backup folders exist and are separate locations...");
FileUtil.EnsureUserAndUtilityFoldersExistAndAreNotIdentical(_hostingEnvironment.ContentRootPath);
//TODO: ENsure report files here

View File

@@ -25,25 +25,24 @@ namespace AyaNova.Util
/// Throws an exception of they are found to be identical preventing startup
/// The reason for this is to prevent a future erase database operation (which erases all attachment files)
/// from erasing backups which might prevent recovery in case someone accidentally erases their database
/// </summary>
/// <param name="contentRootPath"></param>
/// </summary>
/// <returns></returns>
internal static void EnsureUserAndUtilityFoldersExistAndAreNotIdentical(string contentRootPath)
internal static void EnsureUserAndUtilityFoldersExistAndAreNotIdentical()
{
//UserFiles
if (string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_FOLDER_USER_FILES))
ServerBootConfig.AYANOVA_FOLDER_USER_FILES = Path.Combine(contentRootPath, "userfiles");
// //UserFiles
// if (string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_FOLDER_USER_FILES))
// ServerBootConfig.AYANOVA_FOLDER_USER_FILES = Path.Combine(contentRootPath, "userfiles");
//BackupFiles
if (ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES == null)
ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES = Path.Combine(contentRootPath, "backupfiles");
// //BackupFiles
// if (ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES == null)
// ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES = Path.Combine(contentRootPath, "backupfiles");
//Temporary system files (reports etc)
if (ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES == null)
ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES = Path.Combine(contentRootPath, "tempfiles");
// //Temporary system files (reports etc)
// if (ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES == null)
// ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES = Path.Combine(contentRootPath, "tempfiles");