This commit is contained in:
@@ -70,9 +70,9 @@ namespace AyaNova.Util
|
||||
internal static bool AYANOVA_PERMANENTLY_ERASE_DATABASE { get; set; }
|
||||
|
||||
//FILE FOLDERS
|
||||
internal static string AYANOVA_FOLDER_USER_FILES { get; set; }
|
||||
internal static string AYANOVA_FOLDER_BACKUP_FILES { get; set; }
|
||||
internal static string AYANOVA_FOLDER_TEMPORARY_SERVER_FILES { get; set; }
|
||||
internal static string AYANOVA_ATTACHMENT_FILES_PATH { get; set; }
|
||||
internal static string AYANOVA_BACKUP_FILES_PATH { get; set; }
|
||||
internal static string AYANOVA_TEMP_FILES_PATH { get; set; }
|
||||
|
||||
//BACKUP PG_DUMP PATH (IF NOT IN PATH ALREADY)
|
||||
internal static string AYANOVA_BACKUP_PG_DUMP_PATH { get; set; }
|
||||
@@ -162,6 +162,9 @@ namespace AyaNova.Util
|
||||
|
||||
AYANOVA_JWT_SECRET = config.GetValue<string>("AYANOVA_JWT_SECRET");
|
||||
|
||||
//backdoor back door password superuser reset
|
||||
AYANOVA_SET_SUPERUSER_PW = config.GetValue<string>("AYANOVA_SET_SUPERUSER_PW");
|
||||
|
||||
//REPORT RENDERING PROCESS CONTROL
|
||||
int? nTemp = config.GetValue<int?>("AYANOVA_REPORT_RENDERING_TIMEOUT");
|
||||
AYANOVA_REPORT_RENDERING_TIMEOUT = (null == nTemp) ? 30000 : (int)nTemp;//default is 30 seconds
|
||||
@@ -180,79 +183,46 @@ namespace AyaNova.Util
|
||||
|
||||
|
||||
//FOLDERS
|
||||
string DataFolderPath = ActualFullPath(config.GetValue<string>("AYANOVA_DATA_PATH"));
|
||||
string LogPath = ActualFullPath(config.GetValue<string>("AYANOVA_LOG_PATH"));
|
||||
string AttachmentFilesPath = ActualFullPath(config.GetValue<string>("AYANOVA_USER_FILES_PATH"));
|
||||
string BackupFilesPath = ActualFullPath(config.GetValue<string>("AYANOVA_BACKUP_FILES_PATH"));
|
||||
string TempFilesPath = ActualFullPath(config.GetValue<string>("AYANOVA_TEMP_FILES_PATH"));
|
||||
AYANOVA_BACKUP_PG_DUMP_PATH = ActualFullPath(config.GetValue<string>("AYANOVA_BACKUP_PG_DUMP_PATH"));
|
||||
|
||||
//TODO: Implement system where one single data folder can be specified and AyaNova will use that and subfolders under it automatically
|
||||
//but also it honours if specific overrides were set for alternative locations
|
||||
//change "folder" to "path" and update docs and everywhere it's mentioned
|
||||
//AYANOVA_DATA_PATH <---this is used as "root" for all data paths automatically unless more specific
|
||||
string AyaPath = string.Empty;
|
||||
if (string.IsNullOrWhiteSpace(DataFolderPath))
|
||||
{
|
||||
//then they better have paths for *everything* specified
|
||||
if (string.IsNullOrWhiteSpace(LogPath))
|
||||
throw new System.ArgumentNullException("AYANOVA_LOG_PATH configuration setting missing and required");
|
||||
if (string.IsNullOrWhiteSpace(AttachmentFilesPath))
|
||||
throw new System.ArgumentNullException("AYANOVA_ATTACHMENT_FILES_PATH configuration setting missing and required");
|
||||
if (string.IsNullOrWhiteSpace(BackupFilesPath))
|
||||
throw new System.ArgumentNullException("AYANOVA_BACKUP_FILES_PATH configuration setting missing and required");
|
||||
if (string.IsNullOrWhiteSpace(TempFilesPath))
|
||||
throw new System.ArgumentNullException("AYANOVA_TEMP_FILES_PATH configuration setting missing and required");
|
||||
|
||||
//Log folder
|
||||
AyaPath = config.GetValue<string>("AYANOVA_LOG_PATH");
|
||||
if (string.IsNullOrWhiteSpace(AyaPath))
|
||||
throw new System.ArgumentNullException("AYANOVA_LOG_PATH configuration setting missing and required");
|
||||
AYANOVA_LOG_PATH = Path.GetFullPath(FileUtil.StringPathDecodeEnvironmentVariables(AYANOVA_LOG_PATH));
|
||||
/*
|
||||
if (string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_DB_CONNECTION))
|
||||
{
|
||||
Console.WriteLine($"FAIL: AYANOVA_DB_CONNECTION configuration setting missing and required");
|
||||
HaveAllCrticalConfigValues = false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES))
|
||||
{
|
||||
Console.WriteLine($"FAIL: AYANOVA_FOLDER_BACKUP_FILES configuration setting missing and required");
|
||||
HaveAllCrticalConfigValues = false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_FOLDER_USER_FILES))
|
||||
{
|
||||
Console.WriteLine($"FAIL: AYANOVA_FOLDER_USER_FILES configuration setting missing and required");
|
||||
HaveAllCrticalConfigValues = false;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES))
|
||||
{
|
||||
Console.WriteLine($"FAIL: AYANOVA_FOLDER_TEMPORARY_SERVER_FILES configuration setting missing and required");
|
||||
HaveAllCrticalConfigValues = false;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
// if (string.IsNullOrWhiteSpace(AYANOVA_LOG_PATH))
|
||||
// {
|
||||
// //DEFAULT LOG PATH
|
||||
// var currentDir = Directory.GetCurrentDirectory();
|
||||
// AYANOVA_LOG_PATH = Path.Combine(currentDir, "logs");
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// AYANOVA_LOG_PATH = Path.Combine(AYANOVA_LOG_PATH, "logs");
|
||||
// }
|
||||
|
||||
//(note, startup.cs ensures these folders exist via FileUtil because we need IHostingEnvironment)
|
||||
//UserFiles
|
||||
AYANOVA_FOLDER_USER_FILES = Path.GetFullPath(FileUtil.StringPathDecodeEnvironmentVariables(config.GetValue<string>("AYANOVA_FOLDER_USER_FILES")));
|
||||
|
||||
//BackupFiles
|
||||
AYANOVA_FOLDER_BACKUP_FILES = Path.GetFullPath(FileUtil.StringPathDecodeEnvironmentVariables(config.GetValue<string>("AYANOVA_FOLDER_BACKUP_FILES")));
|
||||
|
||||
//TemporaryFiles
|
||||
AYANOVA_FOLDER_TEMPORARY_SERVER_FILES = Path.GetFullPath(FileUtil.StringPathDecodeEnvironmentVariables(config.GetValue<string>("AYANOVA_FOLDER_TEMPORARY_SERVER_FILES")));
|
||||
|
||||
//pgdump backup utility path
|
||||
AYANOVA_BACKUP_PG_DUMP_PATH = Path.GetFullPath(FileUtil.StringPathDecodeEnvironmentVariables(config.GetValue<string>("AYANOVA_BACKUP_PG_DUMP_PATH")));
|
||||
|
||||
//backdoor back door password superuser reset
|
||||
AYANOVA_SET_SUPERUSER_PW = config.GetValue<string>("AYANOVA_SET_SUPERUSER_PW");
|
||||
}
|
||||
else
|
||||
{
|
||||
//set any unspecified paths to the defaults
|
||||
AYANOVA_LOG_PATH = (string.IsNullOrWhiteSpace(LogPath)) ? Path.Combine(DataFolderPath, "logs") : LogPath;
|
||||
AYANOVA_ATTACHMENT_FILES_PATH = (string.IsNullOrWhiteSpace(AttachmentFilesPath)) ? Path.Combine(DataFolderPath, "attachments") : AttachmentFilesPath;
|
||||
AYANOVA_BACKUP_FILES_PATH = (string.IsNullOrWhiteSpace(BackupFilesPath)) ? Path.Combine(DataFolderPath, "backups") : BackupFilesPath;
|
||||
AYANOVA_TEMP_FILES_PATH = (string.IsNullOrWhiteSpace(TempFilesPath)) ? Path.Combine(DataFolderPath, "temp") : TempFilesPath;
|
||||
}
|
||||
|
||||
#endregion server BASICS
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
internal static string ActualFullPath(string p)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(p))
|
||||
return string.Empty;
|
||||
return Path.GetFullPath(FileUtil.StringPathDecodeEnvironmentVariables(p));
|
||||
}
|
||||
|
||||
//Fetch first url from list of urls (used by generator)
|
||||
internal static string FirstOfAyaNovaUseUrls
|
||||
|
||||
Reference in New Issue
Block a user