This commit is contained in:
8
.vscode/launch.json
vendored
8
.vscode/launch.json
vendored
@@ -52,10 +52,10 @@
|
||||
// "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_USER_FILES":"%ProgramData%\\ayanova\\userfiles",
|
||||
"AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles",
|
||||
"AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles",
|
||||
//"AYANOVA_ATTACHMENT_FILES_PATH": "c:\\temp\\RavenTestData\\userfiles",
|
||||
"AYANOVA_ATTACHMENT_FILES_PATH":"%ProgramData%\\ayanova\\userfiles",
|
||||
"AYANOVA_BACKUP_FILES_PATH": "c:\\temp\\RavenTestData\\backupfiles",
|
||||
"AYANOVA_TEMP_FILES_PATH": "c:\\temp\\RavenTestData\\tempfiles",
|
||||
// "AYANOVA_SERVER_TEST_MODE": "false",
|
||||
// "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||
// "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-8",
|
||||
|
||||
@@ -21,7 +21,7 @@ Sometimes 3rd party tools may log to the log file and we may need to restrict th
|
||||
|
||||
## Log path
|
||||
|
||||
By default AyaNova logs to a "logs" folder situated below the folder where AyaNova is started.
|
||||
By default AyaNova logs to a `logs` folder in the location specified by [AYANOVA_DATA_PATH](ops-config-data-path.md) setting.
|
||||
You can override this and set a custom log location by command line argument or by setting the "AYANOVA_LOG_PATH" environment variable.
|
||||
|
||||
Example command line log path parameter
|
||||
|
||||
@@ -18,7 +18,7 @@ The value specified should be a string containing a fully qualified file path to
|
||||
|
||||
Example command line parameter
|
||||
|
||||
`dotnet run --AYANOVA_BACKUP_PG_DUMP_PATH="/usr/lib/postgresql/14.1/bin/"` (not real)
|
||||
`ayanova.exe --AYANOVA_BACKUP_PG_DUMP_PATH="/usr/lib/postgresql/14.1/bin/"` (not real)
|
||||
|
||||
Example environment variable
|
||||
|
||||
|
||||
44
docs/8.0/ayanova/docs/ops-config-data-path.md
Normal file
44
docs/8.0/ayanova/docs/ops-config-data-path.md
Normal file
@@ -0,0 +1,44 @@
|
||||
# DATA PATH SETTING
|
||||
|
||||
This setting controls where AyaNova stores it's data by default and is required to be present unless all other path related configuration settings are specified individually.
|
||||
|
||||
All data path configurations default to a location under the location specified by AYANOVA_DATA_PATH as follows:
|
||||
|
||||
- AYANOVA_BACKUP_FILES_PATH defaults to 'backup' folder inside AYANOVA_DATA_PATH
|
||||
- AYANOVA_ATTACHMENT_FILES_PATH defaults to 'attachments' folder inside AYANOVA_DATA_PATH
|
||||
- AYANOVA_TEMP_FILES_PATH defaults to 'temp' folder inside AYANOVA_DATA_PATH
|
||||
- AYANOVA_LOG_PATH defaults to 'logs' folder inside AYANOVA_DATA_PATH
|
||||
|
||||
|
||||
## Override individual locations
|
||||
|
||||
Each of the path related configuration settings can also be specified individually, any that are left out will default to the above settings.
|
||||
|
||||
## Default
|
||||
|
||||
On Windows computers that use the installer, the default location for this setting is set by the installer the 'ProgramData' folder. There is no default for other operating systems or manual installations.
|
||||
|
||||
## Overriding
|
||||
|
||||
AyaNova expects the data path to be provided by an environment variable or command line parameter named
|
||||
|
||||
`AYANOVA_DATA_PATH`
|
||||
|
||||
The value specified should be a string containing a fully qualified file path for the platform, for example:
|
||||
`c:\ProgramData\ayanova`
|
||||
|
||||
Example command line parameter
|
||||
|
||||
`ayanova.exe --AYANOVA_DATA_PATH="/var/lib/ayanova"`
|
||||
|
||||
Example environment variable
|
||||
|
||||
Windows
|
||||
|
||||
`set "AYANOVA_DATA_PATH=c:\ProgramData\ayanova"`
|
||||
|
||||
Linux / MAC
|
||||
|
||||
`export AYANOVA_DATA_PATH="/var/lib/ayanova"`
|
||||
|
||||
If both a command line parameter and an environment variable are set the command line parameter takes precedence.
|
||||
@@ -14,7 +14,7 @@ AyaNova expects the connection string to be provided by an environment variable
|
||||
|
||||
Example command line parameter:
|
||||
|
||||
`dotnet run --AYANOVA_DB_CONNECTION="Server=localhost;Database=MyAyaNovaDB;"`
|
||||
`ayanova.exe --AYANOVA_DB_CONNECTION="Server=localhost;Database=MyAyaNovaDB;"`
|
||||
|
||||
Example environment variable:
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ or
|
||||
|
||||
Example command line parameter
|
||||
|
||||
`dotnet run --AYANOVA_DEFAULT_TRANSLATION="ES"`
|
||||
`ayanova.exe --AYANOVA_DEFAULT_TRANSLATION="ES"`
|
||||
|
||||
Example environment variable
|
||||
|
||||
|
||||
@@ -10,9 +10,10 @@ These values can all be specified as an environment variable or as a command lin
|
||||
|
||||
## FILE STORAGE LOCATIONS
|
||||
|
||||
- [AYANOVA_FOLDER_BACKUP_FILES](ops-config-folder-backup-files.md)
|
||||
- [AYANOVA_FOLDER_USER_FILES](ops-config-folder-user-files.md)
|
||||
- [AYANOVA_FOLDER_TEMPORARY_SERVER_FILES](ops-config-folder-temporary-files.md)
|
||||
- [AYANOVA_DATA_PATH](ops-config-data-path.md)
|
||||
- [AYANOVA_BACKUP_FILES_PATH](ops-config-folder-backup-files.md)
|
||||
- [AYANOVA_ATTACHMENT_FILES_PATH](ops-config-folder-user-files.md)
|
||||
- [AYANOVA_TEMP_FILES_PATH](ops-config-folder-temporary-files.md)
|
||||
|
||||
## BACKUP UTILITY "pg_dump" PATH
|
||||
- [AYANOVA_BACKUP_PG_DUMP_PATH](ops-config-backup-pgdump-path.md)
|
||||
|
||||
@@ -2,33 +2,33 @@
|
||||
|
||||
This setting controls where AyaNova stores backup and restore files used by the backup and restore features built into AyaNova.
|
||||
|
||||
Warning: this folder MUST NOT be the same location set for [AYANOVA_FOLDER_USER_FILES](ops-config-folder-user-files.md) or [AYANOVA_FOLDER_TEMPORARY_SERVER_FILES](ops-config-folder-temporary-files.md) or AyaNova will not start.
|
||||
Warning: this folder MUST NOT be the same location set for [AYANOVA_ATTACHMENT_FILES_PATH](ops-config-folder-user-files.md) or [AYANOVA_TEMP_FILES_PATH](ops-config-folder-temporary-files.md) or AyaNova will not start.
|
||||
|
||||
## Default
|
||||
|
||||
If no override is specified AyaNova will store backup files in a `backupfiles` folder in the AyaNova root folder where AyaNova is started from.
|
||||
If no override is specified AyaNova will store backup files in a `backup` folder in the location specified by [AYANOVA_DATA_PATH](ops-config-data-path.md) setting.
|
||||
|
||||
## Overriding
|
||||
|
||||
AyaNova expects the backup files folder path to be provided by an environment variable or command line parameter named
|
||||
|
||||
`AYANOVA_FOLDER_BACKUP_FILES`
|
||||
`AYANOVA_BACKUP_FILES_PATH`
|
||||
|
||||
The value specified should be a string containing a fully qualified file path for the platform, for example:
|
||||
`c:\data\ayanova\backupfiles`
|
||||
|
||||
Example command line parameter
|
||||
|
||||
`dotnet run --AYANOVA_FOLDER_BACKUP_FILES="/var/lib/ayanova/backupfiles"`
|
||||
`ayanova.exe --AYANOVA_BACKUP_FILES_PATH="/var/lib/ayanova/backupfiles"`
|
||||
|
||||
Example environment variable
|
||||
|
||||
Windows
|
||||
|
||||
`set "AYANOVA_FOLDER_BACKUP_FILES=c:\data\ayanova\backupfiles"`
|
||||
`set "AYANOVA_BACKUP_FILES_PATH=c:\data\ayanova\backupfiles"`
|
||||
|
||||
Linux / MAC
|
||||
|
||||
`export AYANOVA_FOLDER_BACKUP_FILES="/var/lib/ayanova/backupfiles"`
|
||||
`export AYANOVA_BACKUP_FILES_PATH="/var/lib/ayanova/backupfiles"`
|
||||
|
||||
If both a command line parameter and an environment variable are set the command line parameter takes precedence.
|
||||
|
||||
@@ -2,33 +2,33 @@
|
||||
|
||||
This setting controls where AyaNova stores files temporarily while servicing requests such as report generation etc.
|
||||
|
||||
Warning: this folder MUST NOT be the same location set for [AYANOVA_FOLDER_USER_FILES](ops-config-folder-user-files.md) or [AYANOVA_FOLDER_BACKUP_FILES](ops-config-folder-backup-files.md) or AyaNova will not start.
|
||||
Warning: this folder MUST NOT be the same location set for [AYANOVA_ATTACHMENT_FILES_PATH](ops-config-folder-user-files.md) or [AYANOVA_BACKUP_FILES_PATH](ops-config-folder-backup-files.md) or AyaNova will not start.
|
||||
|
||||
## Default
|
||||
|
||||
If no override is specified AyaNova will store temporary files in a `tempfiles` folder in the AyaNova root folder where AyaNova is started from.
|
||||
If no override is specified AyaNova will store temporary files in a `tempfiles` folder in the location specified by [AYANOVA_DATA_PATH](ops-config-data-path.md) setting.
|
||||
|
||||
## Overriding
|
||||
|
||||
AyaNova expects the temporary files folder path to be provided by an environment variable or command line parameter named
|
||||
|
||||
`AYANOVA_FOLDER_TEMPORARY_SERVER_FILES`
|
||||
`AYANOVA_TEMP_FILES_PATH`
|
||||
|
||||
The value specified should be a string containing a fully qualified file path for the platform, for example:
|
||||
`c:\data\ayanova\tempfiles`
|
||||
|
||||
Example command line parameter
|
||||
|
||||
`dotnet run --AYANOVA_FOLDER_TEMPORARY_SERVER_FILES="/var/lib/ayanova/tempfiles"`
|
||||
`ayanova.exe --AYANOVA_TEMP_FILES_PATH="/var/lib/ayanova/tempfiles"`
|
||||
|
||||
Example environment variable
|
||||
|
||||
Windows
|
||||
|
||||
`set "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES=c:\data\ayanova\tempfiles"`
|
||||
`set "AYANOVA_TEMP_FILES_PATH=c:\data\ayanova\tempfiles"`
|
||||
|
||||
Linux / MAC
|
||||
|
||||
`export AYANOVA_FOLDER_TEMPORARY_SERVER_FILES="/var/lib/ayanova/tempfiles"`
|
||||
`export AYANOVA_TEMP_FILES_PATH="/var/lib/ayanova/tempfiles"`
|
||||
|
||||
If both a command line parameter and an environment variable are set the command line parameter takes precedence.
|
||||
|
||||
@@ -3,33 +3,33 @@
|
||||
This setting controls where AyaNova stores user uploaded files used by features that allow file attachment or uploads.
|
||||
AyaNova stores these files with random names in the folder specified.
|
||||
|
||||
Warning: this folder MUST NOT be the same location set for [AYANOVA_FOLDER_BACKUP_FILES](ops-config-folder-backup-files.md) or [AYANOVA_FOLDER_TEMPORARY_SERVER_FILES](ops-config-folder-temporary-files.md) or AyaNova will not start.
|
||||
Warning: this folder MUST NOT be the same location set for [AYANOVA_BACKUP_FILES_PATH](ops-config-folder-backup-files.md) or [AYANOVA_TEMP_FILES_PATH](ops-config-folder-temporary-files.md) or AyaNova will not start.
|
||||
|
||||
## Default
|
||||
|
||||
If no override is specified AyaNova will store user files in a `userfiles` folder in the AyaNova root folder where AyaNova is started from.
|
||||
If no override is specified AyaNova will store user files in a `userfiles` folder in the location specified by [AYANOVA_DATA_PATH](ops-config-data-path.md) setting.
|
||||
|
||||
## Overriding
|
||||
|
||||
AyaNova expects the user files folder path to be provided by an environment variable or command line parameter named
|
||||
|
||||
`AYANOVA_FOLDER_USER_FILES`
|
||||
`AYANOVA_ATTACHMENT_FILES_PATH`
|
||||
|
||||
The value specified should be a string containing a fully qualified file path for the platform, for example:
|
||||
`c:\data\ayanova\userfiles`
|
||||
|
||||
Example command line parameter
|
||||
|
||||
`dotnet run --AYANOVA_FOLDER_USER_FILES="/var/lib/ayanova/userfiles"`
|
||||
`ayanova.exe --AYANOVA_ATTACHMENT_FILES_PATH="/var/lib/ayanova/userfiles"`
|
||||
|
||||
Example environment variable
|
||||
|
||||
Windows
|
||||
|
||||
`set "AYANOVA_FOLDER_USER_FILES=c:\data\ayanova\userfiles"`
|
||||
`set "AYANOVA_ATTACHMENT_FILES_PATH=c:\data\ayanova\userfiles"`
|
||||
|
||||
Linux / MAC
|
||||
|
||||
`export AYANOVA_FOLDER_USER_FILES="/var/lib/ayanova/userfiles"`
|
||||
`export AYANOVA_ATTACHMENT_FILES_PATH="/var/lib/ayanova/userfiles"`
|
||||
|
||||
If both a command line parameter and an environment variable are set the command line parameter takes precedence.
|
||||
|
||||
@@ -31,7 +31,7 @@ You should use the same precautions as for choosing any other password and ensur
|
||||
|
||||
Example command line parameter
|
||||
|
||||
`dotnet run --AYANOVA_JWT_SECRET="02847This_is_my_secret_key456576"`
|
||||
`ayanova.exe --AYANOVA_JWT_SECRET="02847This_is_my_secret_key456576"`
|
||||
|
||||
Example environment variable
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ The value specified should be a string specifying the value as an integer, for e
|
||||
|
||||
Example command line parameter
|
||||
|
||||
`dotnet run --AYANOVA_REPORT_RENDERING_MAX_INSTANCES="5`
|
||||
`ayanova.exe --AYANOVA_REPORT_RENDERING_MAX_INSTANCES="5`
|
||||
|
||||
Example environment variable
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ The value specified should be a string specifying the timeout in **milliseconds*
|
||||
|
||||
Example command line parameter
|
||||
|
||||
`dotnet run --AYANOVA_REPORT_RENDERING_TIMEOUT="30000`
|
||||
`ayanova.exe --AYANOVA_REPORT_RENDERING_TIMEOUT="30000`
|
||||
|
||||
Example environment variable
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ The value specified should be a string used to temporarily override the super us
|
||||
|
||||
Example command line parameter
|
||||
|
||||
`dotnet run --AYANOVA_SET_SUPERUSER_PW="Th3RainInSpainFallsMainlyOnTh3Pla1n"`
|
||||
`ayanova.exe --AYANOVA_SET_SUPERUSER_PW="Th3RainInSpainFallsMainlyOnTh3Pla1n"`
|
||||
|
||||
Example environment variable
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ The value specified should be a string of one or more semicolon separated values
|
||||
|
||||
Example command line parameter
|
||||
|
||||
`dotnet run --AYANOVA_USE_URLS="http://*:5000"`
|
||||
`ayanova.exe --AYANOVA_USE_URLS="http://*:5000"`
|
||||
|
||||
Example environment variable
|
||||
|
||||
|
||||
@@ -184,9 +184,9 @@ namespace AyaNova.Api.Controllers
|
||||
AYANOVA_USE_URLS = ServerBootConfig.AYANOVA_USE_URLS,
|
||||
AYANOVA_DB_CONNECTION = DbUtil.PasswordRedactedConnectionString(ServerBootConfig.AYANOVA_DB_CONNECTION),
|
||||
AYANOVA_REPORT_RENDERING_TIMEOUT = ServerBootConfig.AYANOVA_REPORT_RENDERING_TIMEOUT,
|
||||
AYANOVA_FOLDER_USER_FILES = ServerBootConfig.AYANOVA_FOLDER_USER_FILES,
|
||||
AYANOVA_FOLDER_BACKUP_FILES = ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES,
|
||||
AYANOVA_FOLDER_TEMPORARY_SERVER_FILES = ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES,
|
||||
AYANOVA_ATTACHMENT_FILES_PATH = ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH,
|
||||
AYANOVA_BACKUP_FILES_PATH = ServerBootConfig.AYANOVA_BACKUP_FILES_PATH,
|
||||
AYANOVA_TEMP_FILES_PATH = ServerBootConfig.AYANOVA_TEMP_FILES_PATH,
|
||||
AYANOVA_BACKUP_PG_DUMP_PATH = ServerBootConfig.AYANOVA_BACKUP_PG_DUMP_PATH,
|
||||
AYANOVA_LOG_PATH = ServerBootConfig.AYANOVA_LOG_PATH,
|
||||
AYANOVA_LOG_LEVEL = ServerBootConfig.AYANOVA_LOG_LEVEL,
|
||||
|
||||
@@ -217,22 +217,22 @@ namespace AyaNova
|
||||
long UtilityFilesAvailableSpace = 0;
|
||||
try
|
||||
{
|
||||
// Console.WriteLine($"##### program:about to call backupfilesdriveavailablespace, config is [{ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES}] ######");
|
||||
UtilityFilesAvailableSpace = new System.IO.DriveInfo(Path.GetPathRoot(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES)).AvailableFreeSpace;
|
||||
// Console.WriteLine($"##### program:about to call backupfilesdriveavailablespace, config is [{ServerBootConfig.AYANOVA_BACKUP_FILES_PATH}] ######");
|
||||
UtilityFilesAvailableSpace = new System.IO.DriveInfo(Path.GetPathRoot(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH)).AvailableFreeSpace;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, $"BOOT::FileUtil::UtilityFilesDriveAvailableSpace error getting available space from [{Path.GetPathRoot(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES)}]");
|
||||
logger.Error(ex, $"BOOT::FileUtil::UtilityFilesDriveAvailableSpace error getting available space from [{Path.GetPathRoot(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH)}]");
|
||||
}
|
||||
|
||||
long AttachmentFilesAvailableSpace = 0;
|
||||
try
|
||||
{
|
||||
AttachmentFilesAvailableSpace = new System.IO.DriveInfo(Path.GetPathRoot(ServerBootConfig.AYANOVA_FOLDER_USER_FILES)).AvailableFreeSpace;
|
||||
AttachmentFilesAvailableSpace = new System.IO.DriveInfo(Path.GetPathRoot(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH)).AvailableFreeSpace;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
logger.Error(ex, $"BOOT::FileUtil::AttachmentFilesDriveAvailableSpace error getting available space from [{Path.GetPathRoot(ServerBootConfig.AYANOVA_FOLDER_USER_FILES)}]");
|
||||
logger.Error(ex, $"BOOT::FileUtil::AttachmentFilesDriveAvailableSpace error getting available space from [{Path.GetPathRoot(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH)}]");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,34 +31,34 @@ namespace AyaNova.Util
|
||||
{
|
||||
|
||||
// //UserFiles
|
||||
// if (string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_FOLDER_USER_FILES))
|
||||
// ServerBootConfig.AYANOVA_FOLDER_USER_FILES = Path.Combine(contentRootPath, "userfiles");
|
||||
// if (string.IsNullOrWhiteSpace(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH))
|
||||
// ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH = Path.Combine(contentRootPath, "userfiles");
|
||||
|
||||
|
||||
// //BackupFiles
|
||||
// if (ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES == null)
|
||||
// ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES = Path.Combine(contentRootPath, "backupfiles");
|
||||
// if (ServerBootConfig.AYANOVA_BACKUP_FILES_PATH == null)
|
||||
// ServerBootConfig.AYANOVA_BACKUP_FILES_PATH = 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");
|
||||
// if (ServerBootConfig.AYANOVA_TEMP_FILES_PATH == null)
|
||||
// ServerBootConfig.AYANOVA_TEMP_FILES_PATH = Path.Combine(contentRootPath, "tempfiles");
|
||||
|
||||
|
||||
|
||||
//Prevent using the same folder for both
|
||||
if (
|
||||
string.Equals(Path.GetFullPath(ServerBootConfig.AYANOVA_FOLDER_USER_FILES), Path.GetFullPath(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES), StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(Path.GetFullPath(ServerBootConfig.AYANOVA_FOLDER_USER_FILES), Path.GetFullPath(ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES), StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(Path.GetFullPath(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES), Path.GetFullPath(ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES), StringComparison.OrdinalIgnoreCase)
|
||||
string.Equals(Path.GetFullPath(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH), Path.GetFullPath(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH), StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(Path.GetFullPath(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH), Path.GetFullPath(ServerBootConfig.AYANOVA_TEMP_FILES_PATH), StringComparison.OrdinalIgnoreCase) ||
|
||||
string.Equals(Path.GetFullPath(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH), Path.GetFullPath(ServerBootConfig.AYANOVA_TEMP_FILES_PATH), StringComparison.OrdinalIgnoreCase)
|
||||
)
|
||||
{
|
||||
throw new System.NotSupportedException("E1040: The configuration settings AYANOVA_FOLDER_USER_FILES, AYANOVA_FOLDER_BACKUP_FILES and AYANOVA_FOLDER_TEMPORARY_SYSTEM_FILES must all be different locations");
|
||||
throw new System.NotSupportedException("E1040: The configuration settings AYANOVA_ATTACHMENT_FILES_PATH, AYANOVA_BACKUP_FILES_PATH and AYANOVA_FOLDER_TEMPORARY_SYSTEM_FILES must all be different locations");
|
||||
}
|
||||
|
||||
EnsurePath(ServerBootConfig.AYANOVA_FOLDER_USER_FILES);
|
||||
EnsurePath(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES);
|
||||
EnsurePath(ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES);
|
||||
EnsurePath(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH);
|
||||
EnsurePath(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH);
|
||||
EnsurePath(ServerBootConfig.AYANOVA_TEMP_FILES_PATH);
|
||||
}
|
||||
|
||||
//create path if doesn't exist already
|
||||
@@ -90,7 +90,7 @@ namespace AyaNova.Util
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES;
|
||||
return ServerBootConfig.AYANOVA_TEMP_FILES_PATH;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace AyaNova.Util
|
||||
/// <returns></returns>
|
||||
internal static string GetFullPathForBackupFile(string fileName)
|
||||
{
|
||||
return Path.Combine(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES, fileName);
|
||||
return Path.Combine(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH, fileName);
|
||||
}
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ namespace AyaNova.Util
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES;
|
||||
// return ServerBootConfig.AYANOVA_BACKUP_FILES_PATH;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -197,7 +197,7 @@ namespace AyaNova.Util
|
||||
BackupStatus statusReport = new BackupStatus();
|
||||
try
|
||||
{
|
||||
statusReport.AvailableFreeSpace = GetBytesReadable(new System.IO.DriveInfo(Path.GetPathRoot(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES)).AvailableFreeSpace);
|
||||
statusReport.AvailableFreeSpace = GetBytesReadable(new System.IO.DriveInfo(Path.GetPathRoot(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH)).AvailableFreeSpace);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -206,7 +206,7 @@ namespace AyaNova.Util
|
||||
log.LogError(ex, "FileUtil::BackupStatusReport error getting available space");
|
||||
}
|
||||
|
||||
var backupFiles = Directory.EnumerateFiles(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES, "*");
|
||||
var backupFiles = Directory.EnumerateFiles(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH, "*");
|
||||
|
||||
foreach (string file in backupFiles.OrderByDescending(z => z))
|
||||
{
|
||||
@@ -246,7 +246,7 @@ namespace AyaNova.Util
|
||||
internal static DateTime MostRecentAutomatedBackupFileDate()
|
||||
{
|
||||
DateTime LastBackup = DateTime.MinValue;
|
||||
foreach (string file in Directory.EnumerateFiles(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES, "db-*.backup"))
|
||||
foreach (string file in Directory.EnumerateFiles(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH, "db-*.backup"))
|
||||
{
|
||||
var ThisFileTime = File.GetCreationTimeUtc(file);
|
||||
if (ThisFileTime > LastBackup)
|
||||
@@ -298,7 +298,7 @@ namespace AyaNova.Util
|
||||
|
||||
name = Path.GetFileName(name);//ensure no directory shenanigans, only a file name is allowed
|
||||
//remove the file completely
|
||||
var DeleteFilePath = Path.Combine(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES, name);
|
||||
var DeleteFilePath = Path.Combine(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH, name);
|
||||
if (File.Exists(DeleteFilePath))
|
||||
{
|
||||
//delete the temp file, it's already stored
|
||||
@@ -318,7 +318,7 @@ namespace AyaNova.Util
|
||||
if (keepCount < 1) keepCount = 1;
|
||||
|
||||
//Database backups
|
||||
var BackupFileList = Directory.EnumerateFiles(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES, "db-*.backup");
|
||||
var BackupFileList = Directory.EnumerateFiles(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH, "db-*.backup");
|
||||
if (BackupFileList.Count() > keepCount)
|
||||
{
|
||||
//sort, skip newest x (keepcount) delete the rest
|
||||
@@ -331,7 +331,7 @@ namespace AyaNova.Util
|
||||
}
|
||||
|
||||
//Attachment backups
|
||||
BackupFileList = Directory.EnumerateFiles(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES, "at-*.zip");
|
||||
BackupFileList = Directory.EnumerateFiles(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH, "at-*.zip");
|
||||
if (BackupFileList.Count() > keepCount)
|
||||
{
|
||||
//sort, skip newest x (keepcount) delete the rest
|
||||
@@ -347,10 +347,10 @@ namespace AyaNova.Util
|
||||
|
||||
internal static long BackupFilesDriveAvailableSpace()
|
||||
{
|
||||
//Console.WriteLine("b fileutil:backupfilesdriveavailablespace, backupfilesfolder:", ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES);
|
||||
//Console.WriteLine("fileutil:backupfilesdriveavailablespace, backupfilesfolder FULLPATH:", Path.GetFullPath(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES));
|
||||
// Console.WriteLine("fileutil:backupfilesdriveavailablespace, backupfilesfolder PATHROOT:", Path.GetPathRoot(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES));
|
||||
return new System.IO.DriveInfo(Path.GetPathRoot(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES)).AvailableFreeSpace;
|
||||
//Console.WriteLine("b fileutil:backupfilesdriveavailablespace, backupfilesfolder:", ServerBootConfig.AYANOVA_BACKUP_FILES_PATH);
|
||||
//Console.WriteLine("fileutil:backupfilesdriveavailablespace, backupfilesfolder FULLPATH:", Path.GetFullPath(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH));
|
||||
// Console.WriteLine("fileutil:backupfilesdriveavailablespace, backupfilesfolder PATHROOT:", Path.GetPathRoot(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH));
|
||||
return new System.IO.DriveInfo(Path.GetPathRoot(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH)).AvailableFreeSpace;
|
||||
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ namespace AyaNova.Util
|
||||
// {
|
||||
// get
|
||||
// {
|
||||
// return ServerBootConfig.AYANOVA_FOLDER_USER_FILES;
|
||||
// return ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH;
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -417,7 +417,7 @@ namespace AyaNova.Util
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.Combine(ServerBootConfig.AYANOVA_FOLDER_USER_FILES, NewRandomFileName);
|
||||
return Path.Combine(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH, NewRandomFileName);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ namespace AyaNova.Util
|
||||
/// <returns>Path without the file</returns>
|
||||
internal static string GetPermanentAttachmentPath(string hash)
|
||||
{
|
||||
return Path.Combine(ServerBootConfig.AYANOVA_FOLDER_USER_FILES, hash[0].ToString(), hash[1].ToString(), hash[2].ToString());
|
||||
return Path.Combine(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH, hash[0].ToString(), hash[1].ToString(), hash[2].ToString());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -496,7 +496,7 @@ namespace AyaNova.Util
|
||||
/// <returns></returns>
|
||||
internal static string GetPermanentAttachmentFilePath(string hash)
|
||||
{
|
||||
return Path.Combine(ServerBootConfig.AYANOVA_FOLDER_USER_FILES, hash[0].ToString(), hash[1].ToString(), hash[2].ToString(), hash);
|
||||
return Path.Combine(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH, hash[0].ToString(), hash[1].ToString(), hash[2].ToString(), hash);
|
||||
}
|
||||
|
||||
|
||||
@@ -554,7 +554,7 @@ namespace AyaNova.Util
|
||||
/// </summary>
|
||||
internal static void EraseEntireContentsOfAttachmentFilesFolder()
|
||||
{
|
||||
System.IO.DirectoryInfo di = new DirectoryInfo(ServerBootConfig.AYANOVA_FOLDER_USER_FILES);
|
||||
System.IO.DirectoryInfo di = new DirectoryInfo(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH);
|
||||
foreach (FileInfo file in di.EnumerateFiles())
|
||||
{
|
||||
file.Delete();
|
||||
@@ -573,7 +573,7 @@ namespace AyaNova.Util
|
||||
var AttachmentsBackupFile = $"{demandFileNamePrepend}at-{FileUtil.GetSafeDateFileName()}.zip";//presentation issue so don't use UTC for this one
|
||||
AttachmentsBackupFile = GetFullPathForBackupFile(AttachmentsBackupFile);
|
||||
|
||||
System.IO.Compression.ZipFile.CreateFromDirectory(ServerBootConfig.AYANOVA_FOLDER_USER_FILES, AttachmentsBackupFile);
|
||||
System.IO.Compression.ZipFile.CreateFromDirectory(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH, AttachmentsBackupFile);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -587,12 +587,12 @@ namespace AyaNova.Util
|
||||
|
||||
internal static long AttachmentFilesDriveAvailableSpace()
|
||||
{
|
||||
return new System.IO.DriveInfo(Path.GetPathRoot(ServerBootConfig.AYANOVA_FOLDER_USER_FILES)).AvailableFreeSpace;
|
||||
return new System.IO.DriveInfo(Path.GetPathRoot(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH)).AvailableFreeSpace;
|
||||
}
|
||||
|
||||
internal static IEnumerable<string> GetAllAttachmentFilePaths()
|
||||
{
|
||||
return Directory.EnumerateFiles(ServerBootConfig.AYANOVA_FOLDER_USER_FILES, "*", SearchOption.AllDirectories);
|
||||
return Directory.EnumerateFiles(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH, "*", SearchOption.AllDirectories);
|
||||
}
|
||||
|
||||
|
||||
@@ -710,7 +710,7 @@ namespace AyaNova.Util
|
||||
/// <returns></returns>
|
||||
internal static FolderSizeInfo GetAttachmentFolderSizeInfo()
|
||||
{
|
||||
return GetDirectorySize(new DirectoryInfo(ServerBootConfig.AYANOVA_FOLDER_USER_FILES));
|
||||
return GetDirectorySize(new DirectoryInfo(ServerBootConfig.AYANOVA_ATTACHMENT_FILES_PATH));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -719,7 +719,7 @@ namespace AyaNova.Util
|
||||
/// <returns></returns>
|
||||
internal static FolderSizeInfo GetBackupFolderSizeInfo()
|
||||
{
|
||||
return GetDirectorySize(new DirectoryInfo(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES));
|
||||
return GetDirectorySize(new DirectoryInfo(ServerBootConfig.AYANOVA_BACKUP_FILES_PATH));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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