2using System.Reflection;
3using System.Threading.Tasks;
35 public override string Resource =>
"/Settings/Backup.md";
86 await base.InitSetup(WebServer);
105 WebServer.
Unregister(this.updateBackupSettings);
106 WebServer.
Unregister(this.updateBackupFolderSettings);
108 return base.UnregisterSetup(WebServer);
111 internal async Task UpdateExportFolder(
string Folder)
113 if (!(this.exportFolder is
null))
114 this.exportFolder.FolderPath = Folder;
119 PropertyInfo PI = T.GetProperty(
"AutoRepairReportFolder");
121 if (!(PI is
null) && PI.PropertyType == typeof(
string))
126 internal void UpdateExportKeyFolder(
string Folder)
128 if (!(this.keyFolder is
null))
129 this.keyFolder.FolderPath = Folder;
138 return Task.FromResult(
true);
201 if (!
string.IsNullOrEmpty(s))
203 if (!TimeSpan.TryParse(s, out TimeSpan BackupTime) || BackupTime < TimeSpan.Zero || BackupTime.TotalHours >= 24)
213 if (!
string.IsNullOrEmpty(s))
215 if (!
int.TryParse(s, out
int i) || i < 0)
225 if (!
string.IsNullOrEmpty(s))
227 if (!
int.TryParse(s, out
int i) || i < 0)
237 if (!
string.IsNullOrEmpty(s))
239 if (!
int.TryParse(s, out
int i) || i < 0)
252 if (!Directory.Exists(s))
253 Directory.CreateDirectory(s);
264 if (!
string.IsNullOrEmpty(s))
268 if (!Directory.Exists(s))
269 Directory.CreateDirectory(s);
280 if (!
string.IsNullOrEmpty(s))
284 if (!
string.IsNullOrEmpty(s))
Static class managing data export.
static async Task< string > GetFullExportFolderAsync()
Full path to export folder.
static async Task< string > GetFullKeyExportFolderAsync()
Full path to key folder.
static async Task SetKeepDaysAsync(long Value)
For how many days backups are kept.
static async Task SetKeepMonthsAsync(long Value)
For how many months the monthly backups are kept.
static async Task SetAutomaticBackupsAsync(bool Value)
If automatic backups are activated
static async Task SetKeyHostsAsync(string[] Value)
Secondary key hosts.
static async Task SetBackupTimeAsync(TimeSpan Value)
Time of day to start performing backups.
static async Task SetBackupHostsAsync(string[] Value)
Secondary backup hosts.
static async Task SetKeepYearsAsync(long Value)
For how many years the yearly backups are kept.
static async Task SetExportFolderAsync(string Value)
Export folder.
static async Task SetExportKeyFolderAsync(string Value)
Key folder
Static class managing the runtime environment of the IoT Gateway.
static RequiredUserPrivileges LoggedIn(string[] Privileges)
Authentication mechanism that makes sure the call is made from a session with a valid authenticated u...
static IDatabaseProvider InternalDatabase
Local Internal Encrypted Object Database provider.
const string GATEWAY_BACKUP
Environment variable name containing a Boolean value if automatic backups should be made or not.
override void SetStaticInstance(ISystemConfiguration Configuration)
Sets the static instance of the configuration.
override string Resource
Resource to be redirected to, to perform the configuration.
const string GATEWAY_BACKUP_FOLDER
Environment variable name containing the backup folder, if different from the default.
override async Task< bool > EnvironmentConfiguration()
Environment configuration by configuring values available in environment variables.
const string GATEWAY_BACKUP_MONTHS
Environment variable name containing the number of months monthly backups are kept.
const string GATEWAY_KEY_HOSTS
Environment variable name containing a comma-delimited list of secondary key hosts for redundant stor...
override int Priority
Priority of the setting. Configurations are sorted in ascending order.
override Task< string > Title(Language Language)
Gets a title for the system configuration.
override async Task InitSetup(HttpServer WebServer)
Initializes the setup object.
override async Task ConfigureSystem()
Is called during startup to configure the system.
const string GATEWAY_KEY_FOLDER
Environment variable name containing the key folder, if different from the default.
static BackupConfiguration Instance
Current instance of configuration.
const string GATEWAY_BACKUP_DAYS
Environment variable name containing the number of days daily backups are kept.
const string GATEWAY_BACKUP_HOSTS
Environment variable name containing a comma-delimited list of secondary backup hosts for redundant s...
override Task UnregisterSetup(HttpServer WebServer)
Unregisters the setup object.
override string ConfigPrivilege
Minimum required privilege for a user to be allowed to change the configuration defined by the class.
const string GATEWAY_BACKUP_YEARS
Environment variable name containing the number of years yearly backups are kept.
const string GATEWAY_BACKUP_TIME
Environment variable name containing a TimeSpan value determining the time of day automatic backups a...
override Task< bool > SimplifiedConfiguration()
Simplified configuration by configuring simple default values.
Abstract base class for system configurations.
void LogEnvironmentVariableInvalidIntegerError(string EnvironmentVariable, object Value)
Logs an error to the event log, telling the operator an environment variable value is not a valid int...
void LogEnvironmentError(string EnvironmentVariable, object Value)
Logs an error to the event log, telling the operator an environment variable value contains an error.
bool TryGetEnvironmentVariable(string VariableName, bool Required, out string Value)
Tries to get a string-valued environment variable.
void LogEnvironmentVariableInvalidTimeError(string EnvironmentVariable, object Value)
Logs an error to the event log, telling the operator an environment variable value is not a valid tim...
Deletes an exported file.
Starts analyzing the database
Web Resource for updating where backup files are storeed.
Web Resource for updating backup settings.
Base class for all HTTP authentication schemes, as defined in RFC-7235: https://datatracker....
Publishes a folder with all its files and subfolders through HTTP GET, with optional support for PUT,...
Implements an HTTP server.
HttpResource Register(HttpResource Resource)
Registers a resource with the server.
bool Unregister(HttpResource Resource)
Unregisters a resource from the server.
Contains information about a language.
Task< string > GetStringAsync(Type Type, int Id, string Default)
Gets the string value of a string ID. If no such string exists, a string is created with the default ...
Interface for system configurations. The gateway will scan all module for system configuration classe...
HostDomainOptions
Options on how to handle domain names provided in the Host header.