This commit is contained in:
1
.vscode/launch.json
vendored
1
.vscode/launch.json
vendored
@@ -51,6 +51,7 @@
|
||||
"AYANOVA_USE_URLS": "http://*:7575;",
|
||||
"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": "-7",
|
||||
|
||||
@@ -12,6 +12,7 @@ These values can all be specified as an environment variable or as a command lin
|
||||
|
||||
- [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)
|
||||
|
||||
## BACKUP UTILITY "pg_dump" PATH
|
||||
- [AYANOVA_BACKUP_PG_DUMP_PATH](ops-config-backup-pgdump-path.md)
|
||||
@@ -31,8 +32,7 @@ These values can all be specified as an environment variable or as a command lin
|
||||
|
||||
- [AYANOVA_JWT_SECRET](ops-config-jwt-secret.md)
|
||||
- [AYANOVA_USE_URLS](ops-config-use-urls.md)
|
||||
- [AYANOVA_FOLDER_USER_FILES](ops-config-folder-user-files.md)
|
||||
- [AYANOVA_FOLDER_BACKUP_FILES](ops-config-folder-backup-files.md)
|
||||
|
||||
|
||||
## SECURITY
|
||||
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
# BACKUP FILES FOLDER SETTING
|
||||
|
||||
This setting controls where AyaNova stores backup and restore files used by the backup and restore features built into AyaNova.
|
||||
In addition this folder is used when importing from an AyaNova 7 export file.
|
||||
|
||||
Warning: this folder MUST NOT be the same location set for [AYANOVA_FOLDER_USER_FILES](ops-config-folder-user-files.md) or AyaNova will not start.
|
||||
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.
|
||||
|
||||
## Default
|
||||
|
||||
|
||||
34
docs/8.0/ayanova/docs/ops-config-folder-temporary-files.md
Normal file
34
docs/8.0/ayanova/docs/ops-config-folder-temporary-files.md
Normal file
@@ -0,0 +1,34 @@
|
||||
# TEMPORARY SERVER FILES FOLDER SETTING
|
||||
|
||||
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.
|
||||
|
||||
## 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.
|
||||
|
||||
## 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`
|
||||
|
||||
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"`
|
||||
|
||||
Example environment variable
|
||||
|
||||
Windows
|
||||
|
||||
`set "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES=c:\data\ayanova\tempfiles"`
|
||||
|
||||
Linux / MAC
|
||||
|
||||
`export AYANOVA_FOLDER_TEMPORARY_SERVER_FILES="/var/lib/ayanova/tempfiles"`
|
||||
|
||||
If both a command line parameter and an environment variable are set the command line parameter takes precedence.
|
||||
@@ -3,7 +3,7 @@
|
||||
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 will not start.
|
||||
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.
|
||||
|
||||
## Default
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@ nav:
|
||||
- 'Translation / Language': 'ops-config-default-translation.md'
|
||||
- 'Backup files folder': 'ops-config-folder-backup-files.md'
|
||||
- 'User files folder': 'ops-config-folder-user-files.md'
|
||||
- 'Server temporary files folder': 'ops-config-folder-temporary-files.md'
|
||||
- 'Database configuration': 'ops-config-db.md'
|
||||
- 'PORT and URL configuration': 'ops-config-use-urls.md'
|
||||
- 'Environment variable reference': 'ops-config-environment-variables.md'
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<PackageReference Include="NLog" Version="4.7.2" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.9.2" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.4" />
|
||||
<PackageReference Include="PuppeteerSharp" Version="2.0.4" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.4.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="5.4.1" />
|
||||
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="5.4.1" />
|
||||
|
||||
@@ -7,7 +7,7 @@ using Microsoft.Extensions.Logging;
|
||||
using AyaNova.Models;
|
||||
using AyaNova.Api.ControllerHelpers;
|
||||
using AyaNova.Biz;
|
||||
|
||||
using PuppeteerSharp;
|
||||
|
||||
namespace AyaNova.Api.Controllers
|
||||
{
|
||||
@@ -44,11 +44,24 @@ namespace AyaNova.Api.Controllers
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
|
||||
switch(test){
|
||||
switch (test)
|
||||
{
|
||||
case "chrome-reddit-to-pdf":
|
||||
//first test, just render a web page to pdf and return it
|
||||
//return PhysicalFile(filePath, mimetype, dbObject.DisplayFileName);
|
||||
break;
|
||||
//first test, just render a web page to pdf and return it
|
||||
//return PhysicalFile(filePath, mimetype, dbObject.DisplayFileName);
|
||||
|
||||
await new BrowserFetcher().DownloadAsync(BrowserFetcher.DefaultRevision);
|
||||
var browser = await Puppeteer.LaunchAsync(new LaunchOptions
|
||||
{
|
||||
Headless = true
|
||||
});
|
||||
var page = await browser.NewPageAsync();
|
||||
await page.GoToAsync("http://www.reddit.com");
|
||||
|
||||
await page.PdfAsync(outputFile);
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,11 +69,17 @@ namespace AyaNova.Api.Controllers
|
||||
|
||||
//return PhysicalFile(filePath, mimetype, dbObject.DisplayFileName);
|
||||
}
|
||||
|
||||
//https://github.com/hardkoded/puppeteer-sharp
|
||||
//http://www.puppeteersharp.com/api/index.html
|
||||
//https://github.com/hardkoded/puppeteer-sharp
|
||||
|
||||
//------------
|
||||
/*
|
||||
NOTES/TODO during testing
|
||||
|
||||
Need a temporary folder path dedicated to generating pdf's etc, a utility path just for that purpose, perhaps in a dedicated folder in the utility / backup region
|
||||
|
||||
|
||||
*/
|
||||
|
||||
}//eoc
|
||||
}//eons
|
||||
@@ -154,6 +154,7 @@ namespace AyaNova.Api.Controllers
|
||||
AYANOVA_DB_CONNECTION = ServerBootConfig.AYANOVA_DB_CONNECTION,
|
||||
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_BACKUP_PG_DUMP_PATH = ServerBootConfig.AYANOVA_BACKUP_PG_DUMP_PATH,
|
||||
AYANOVA_LOG_PATH = ServerBootConfig.AYANOVA_LOG_PATH,
|
||||
AYANOVA_LOG_LEVEL = ServerBootConfig.AYANOVA_LOG_LEVEL,
|
||||
|
||||
@@ -33,24 +33,33 @@ namespace AyaNova.Util
|
||||
|
||||
//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");
|
||||
}
|
||||
|
||||
|
||||
//Temporary system files (reports etc)
|
||||
if (ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES == null)
|
||||
ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES = 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))
|
||||
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)
|
||||
)
|
||||
{
|
||||
throw new System.NotSupportedException("E1040: The configuration settings AYANOVA_FOLDER_USER_FILES and the AYANOVA_FOLDER_BACKUP_FILES must not point to the exact same location");
|
||||
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");
|
||||
}
|
||||
|
||||
EnsurePath(ServerBootConfig.AYANOVA_FOLDER_USER_FILES);
|
||||
EnsurePath(ServerBootConfig.AYANOVA_FOLDER_BACKUP_FILES);
|
||||
EnsurePath(ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES);
|
||||
}
|
||||
|
||||
//create path if doesn't exist already
|
||||
@@ -61,6 +70,35 @@ namespace AyaNova.Util
|
||||
}
|
||||
#endregion folder ensurance
|
||||
|
||||
#region Temporary files handling
|
||||
/// <summary>
|
||||
/// Get backup file folder
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal static string TemporaryFilesFolder
|
||||
{
|
||||
get
|
||||
{
|
||||
return ServerBootConfig.AYANOVA_FOLDER_TEMPORARY_SERVER_FILES;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a random file name with path to temporary files folder
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal static string NewRandomTempFilesFolderFileName
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.Combine(TemporaryFilesFolder, NewRandomFileName);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Utility (BACKUP) file handling
|
||||
|
||||
|
||||
@@ -315,17 +353,7 @@ namespace AyaNova.Util
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a random file name
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal static string NewRandomFileName
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.GetRandomFileName();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get a random file name with path to attachments folder
|
||||
@@ -569,6 +597,18 @@ namespace AyaNova.Util
|
||||
|
||||
#region General utilities
|
||||
|
||||
/// <summary>
|
||||
/// Get a random file name
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal static string NewRandomFileName
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.GetRandomFileName();
|
||||
}
|
||||
}
|
||||
|
||||
//https://stackoverflow.com/a/11124118/8939
|
||||
// Returns the human-readable file size for an arbitrary, 64-bit file size
|
||||
// The default format is "0.### XB", e.g. "4.2 KB" or "1.434 GB"
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace AyaNova.Util
|
||||
//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; }
|
||||
|
||||
//BACKUP PG_DUMP PATH (IF NOT IN PATH ALREADY)
|
||||
internal static string AYANOVA_BACKUP_PG_DUMP_PATH { get; set; }
|
||||
@@ -159,6 +160,9 @@ namespace AyaNova.Util
|
||||
//BackupFiles
|
||||
AYANOVA_FOLDER_BACKUP_FILES = config.GetValue<string>("AYANOVA_FOLDER_BACKUP_FILES");
|
||||
|
||||
//TemporaryFiles
|
||||
AYANOVA_FOLDER_TEMPORARY_SERVER_FILES = config.GetValue<string>("AYANOVA_FOLDER_TEMPORARY_SERVER_FILES");
|
||||
|
||||
//pgdump backup utility path
|
||||
AYANOVA_BACKUP_PG_DUMP_PATH = config.GetValue<string>("AYANOVA_BACKUP_PG_DUMP_PATH");
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
dotnet run -p ./server/AyaNova -- --AYANOVA_DB_CONNECTION="Server=localhost;Username=postgres;Password=raven;Database=AyaNova;" --AYANOVA_LOG_LEVEL="Info" --AYANOVA_DEFAULT_TRANSLATION="en" --AYANOVA_USE_URLS="http://*:7575;" --AYANOVA_FOLDER_USER_FILES="c:\temp\RavenTestData\userfiles" --AYANOVA_FOLDER_BACKUP_FILES="c:\temp\RavenTestData\backupfiles"
|
||||
dotnet run -p ./server/AyaNova -- --AYANOVA_DB_CONNECTION="Server=localhost;Username=postgres;Password=raven;Database=AyaNova;" --AYANOVA_LOG_LEVEL="Info" --AYANOVA_DEFAULT_TRANSLATION="en" --AYANOVA_USE_URLS="http://*:7575;" --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"
|
||||
Reference in New Issue
Block a user