mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-04 04:56:52 +00:00
Make borg_backup_host_location an attribute
Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
parent
5b0b9ef826
commit
b4d198f72b
4 changed files with 16 additions and 16 deletions
|
|
@ -93,7 +93,7 @@ $app->get('/containers', function (Request $request, Response $response, array $
|
|||
return $view->render($response, 'containers.twig', [
|
||||
'domain' => $configurationManager->domain,
|
||||
'apache_port' => $configurationManager->GetApachePort(),
|
||||
'borg_backup_host_location' => $configurationManager->GetBorgBackupHostLocation(),
|
||||
'borg_backup_host_location' => $configurationManager->borg_backup_host_location,
|
||||
'borg_remote_repo' => $configurationManager->GetBorgRemoteRepo(),
|
||||
'borg_public_key' => $configurationManager->GetBorgPublicKey(),
|
||||
'nextcloud_password' => $configurationManager->GetAndGenerateSecret('NEXTCLOUD_PASSWORD'),
|
||||
|
|
|
|||
|
|
@ -113,7 +113,7 @@ readonly class ContainerDefinitionFetcher {
|
|||
if (isset($entry['volumes'])) {
|
||||
foreach ($entry['volumes'] as $value) {
|
||||
if($value['source'] === '%BORGBACKUP_HOST_LOCATION%') {
|
||||
$value['source'] = $this->configurationManager->GetBorgBackupHostLocation();
|
||||
$value['source'] = $this->configurationManager->borg_backup_host_location;
|
||||
if($value['source'] === '') {
|
||||
continue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,6 +109,11 @@ class ConfigurationManager
|
|||
set { $this->SetDomain($value); }
|
||||
}
|
||||
|
||||
public string $borg_backup_host_location {
|
||||
get => $this->get('borg_backup_host_location', '');
|
||||
set { $this->set('borg_backup_host_location', $value); }
|
||||
}
|
||||
|
||||
public function GetConfig() : array
|
||||
{
|
||||
if ($this->config === [] && file_exists(DataConst::GetConfigFile()))
|
||||
|
|
@ -379,9 +384,11 @@ class ConfigurationManager
|
|||
$this->ValidateBorgLocationVars($location, $repo);
|
||||
|
||||
$config = $this->GetConfig();
|
||||
$config['borg_backup_host_location'] = $location;
|
||||
$config['borg_remote_repo'] = $repo;
|
||||
$this->WriteConfig($config);
|
||||
$this->setMultiple(function ($confManager) use ($location) {
|
||||
$confManager->borg_backup_host_location = $location;
|
||||
});
|
||||
}
|
||||
|
||||
private function ValidateBorgLocationVars(string $location, string $repo) : void {
|
||||
|
|
@ -428,9 +435,11 @@ class ConfigurationManager
|
|||
public function DeleteBorgBackupLocationItems() : void {
|
||||
// Delete the variables
|
||||
$config = $this->GetConfig();
|
||||
$config['borg_backup_host_location'] = '';
|
||||
$config['borg_remote_repo'] = '';
|
||||
$this->WriteConfig($config);
|
||||
$this->setMultiple(function ($confManager) {
|
||||
$confManager->borg_backup_host_location = '';
|
||||
});
|
||||
|
||||
// Also delete the borg config file to be able to start over
|
||||
if (file_exists(DataConst::GetBackupKeyFile())) {
|
||||
|
|
@ -451,12 +460,12 @@ class ConfigurationManager
|
|||
}
|
||||
|
||||
$config = $this->GetConfig();
|
||||
$config['borg_backup_host_location'] = $location;
|
||||
$config['borg_remote_repo'] = $repo;
|
||||
$config['borg_restore_password'] = $password;
|
||||
$this->WriteConfig($config);
|
||||
|
||||
$this->setMultiple(function ($confManager) {
|
||||
$this->setMultiple(function ($confManager) use ($location) {
|
||||
$confManager->borg_backup_host_location = $location;
|
||||
$confManager->instance_restore_attempt = true;
|
||||
});
|
||||
}
|
||||
|
|
@ -556,15 +565,6 @@ class ConfigurationManager
|
|||
return $envVariableOutput;
|
||||
}
|
||||
|
||||
public function GetBorgBackupHostLocation() : string {
|
||||
$config = $this->GetConfig();
|
||||
if(!isset($config['borg_backup_host_location'])) {
|
||||
$config['borg_backup_host_location'] = '';
|
||||
}
|
||||
|
||||
return $config['borg_backup_host_location'];
|
||||
}
|
||||
|
||||
public function GetBorgRemoteRepo() : string {
|
||||
$config = $this->GetConfig();
|
||||
if(!isset($config['borg_remote_repo'])) {
|
||||
|
|
|
|||
|
|
@ -589,7 +589,7 @@ readonly class DockerActionManager {
|
|||
'FULLTEXTSEARCH_JAVA_OPTIONS' => $this->configurationManager->GetFulltextsearchJavaOptions(),
|
||||
'NEXTCLOUD_TRUSTED_CACERTS_DIR' => $this->configurationManager->GetTrustedCacertsDir(),
|
||||
'ADDITIONAL_DIRECTORIES_BACKUP' => $this->configurationManager->GetAdditionalBackupDirectoriesString() !== '' ? 'yes' : '',
|
||||
'BORGBACKUP_HOST_LOCATION' => $this->configurationManager->GetBorgBackupHostLocation(),
|
||||
'BORGBACKUP_HOST_LOCATION' => $this->configurationManager->borg_backup_host_location,
|
||||
'APACHE_MAX_SIZE' => (string)($this->configurationManager->GetApacheMaxSize()),
|
||||
'COLLABORA_SECCOMP_POLICY' => $this->configurationManager->GetCollaboraSeccompPolicy(),
|
||||
'NEXTCLOUD_STARTUP_APPS' => $this->configurationManager->GetNextcloudStartupApps(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue