mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-13 17:20:21 +00:00
Make borg_restore_password an attribute
Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
parent
6df0333f71
commit
f030abcafd
3 changed files with 11 additions and 16 deletions
|
|
@ -114,7 +114,7 @@ $app->get('/containers', function (Request $request, Response $response, array $
|
||||||
'is_onlyoffice_enabled' => $configurationManager->isOnlyofficeEnabled,
|
'is_onlyoffice_enabled' => $configurationManager->isOnlyofficeEnabled,
|
||||||
'is_collabora_enabled' => $configurationManager->isCollaboraEnabled,
|
'is_collabora_enabled' => $configurationManager->isCollaboraEnabled,
|
||||||
'is_talk_enabled' => $configurationManager->isTalkEnabled,
|
'is_talk_enabled' => $configurationManager->isTalkEnabled,
|
||||||
'borg_restore_password' => $configurationManager->GetBorgRestorePassword(),
|
'borg_restore_password' => $configurationManager->borg_restore_password,
|
||||||
'daily_backup_time' => $configurationManager->GetDailyBackupTime(),
|
'daily_backup_time' => $configurationManager->GetDailyBackupTime(),
|
||||||
'is_daily_backup_running' => $configurationManager->isDailyBackupRunning(),
|
'is_daily_backup_running' => $configurationManager->isDailyBackupRunning(),
|
||||||
'timezone' => $configurationManager->GetTimezone(),
|
'timezone' => $configurationManager->GetTimezone(),
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,11 @@ class ConfigurationManager
|
||||||
set { $this->set('borg_remote_repo', $value); }
|
set { $this->set('borg_remote_repo', $value); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string $borg_restore_password {
|
||||||
|
get => $this->get('borg_restore_password', '');
|
||||||
|
set { $this->set('borg_restore_password', $value); }
|
||||||
|
}
|
||||||
|
|
||||||
public function GetConfig() : array
|
public function GetConfig() : array
|
||||||
{
|
{
|
||||||
if ($this->config === [] && file_exists(DataConst::GetConfigFile()))
|
if ($this->config === [] && file_exists(DataConst::GetConfigFile()))
|
||||||
|
|
@ -364,13 +369,13 @@ class ConfigurationManager
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = $this->GetConfig();
|
$config = $this->GetConfig();
|
||||||
// Reset the borg restore password when setting the domain
|
|
||||||
$config['borg_restore_password'] = '';
|
|
||||||
$this->WriteConfig($config);
|
$this->WriteConfig($config);
|
||||||
$this->setMultiple(function ($confManager) use ($domain) {
|
$this->setMultiple(function ($confManager) use ($domain) {
|
||||||
// Write domain
|
// Write domain
|
||||||
// Don't set the domain via the attribute, or we create a loop.
|
// Don't set the domain via the attribute, or we create a loop.
|
||||||
$confManager->set('domain', $domain);
|
$confManager->set('domain', $domain);
|
||||||
|
// Reset the borg restore password when setting the domain
|
||||||
|
$confManager->borg_restore_password = '';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -465,12 +470,11 @@ class ConfigurationManager
|
||||||
}
|
}
|
||||||
|
|
||||||
$config = $this->GetConfig();
|
$config = $this->GetConfig();
|
||||||
$config['borg_restore_password'] = $password;
|
|
||||||
$this->WriteConfig($config);
|
$this->WriteConfig($config);
|
||||||
|
$this->setMultiple(function ($confManager) use ($location, $repo, $password) {
|
||||||
$this->setMultiple(function ($confManager) use ($location, $repo) {
|
|
||||||
$confManager->borg_backup_host_location = $location;
|
$confManager->borg_backup_host_location = $location;
|
||||||
$confManager->borg_remote_repo = $repo;
|
$confManager->borg_remote_repo = $repo;
|
||||||
|
$confManager->borg_restore_password = $password;
|
||||||
$confManager->instance_restore_attempt = true;
|
$confManager->instance_restore_attempt = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -578,15 +582,6 @@ class ConfigurationManager
|
||||||
return trim((string)file_get_contents(DataConst::GetBackupPublicKey()));
|
return trim((string)file_get_contents(DataConst::GetBackupPublicKey()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function GetBorgRestorePassword() : string {
|
|
||||||
$config = $this->GetConfig();
|
|
||||||
if(!isset($config['borg_restore_password'])) {
|
|
||||||
$config['borg_restore_password'] = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return $config['borg_restore_password'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function GetNextcloudMount() : string {
|
public function GetNextcloudMount() : string {
|
||||||
$envVariableName = 'NEXTCLOUD_MOUNT';
|
$envVariableName = 'NEXTCLOUD_MOUNT';
|
||||||
$configName = 'nextcloud_mount';
|
$configName = 'nextcloud_mount';
|
||||||
|
|
|
||||||
|
|
@ -570,7 +570,7 @@ readonly class DockerActionManager {
|
||||||
'TALK_PORT' => $this->configurationManager->GetTalkPort(),
|
'TALK_PORT' => $this->configurationManager->GetTalkPort(),
|
||||||
'TURN_DOMAIN' => $this->configurationManager->GetTurnDomain(),
|
'TURN_DOMAIN' => $this->configurationManager->GetTurnDomain(),
|
||||||
'NEXTCLOUD_MOUNT' => $this->configurationManager->GetNextcloudMount(),
|
'NEXTCLOUD_MOUNT' => $this->configurationManager->GetNextcloudMount(),
|
||||||
'BACKUP_RESTORE_PASSWORD' => $this->configurationManager->GetBorgRestorePassword(),
|
'BACKUP_RESTORE_PASSWORD' => $this->configurationManager->borg_restore_password,
|
||||||
'CLAMAV_ENABLED' => $this->configurationManager->isClamavEnabled ? 'yes' : '',
|
'CLAMAV_ENABLED' => $this->configurationManager->isClamavEnabled ? 'yes' : '',
|
||||||
'TALK_RECORDING_ENABLED' => $this->configurationManager->isTalkRecordingEnabled ? 'yes' : '',
|
'TALK_RECORDING_ENABLED' => $this->configurationManager->isTalkRecordingEnabled ? 'yes' : '',
|
||||||
'ONLYOFFICE_ENABLED' => $this->configurationManager->isOnlyofficeEnabled ? 'yes' : '',
|
'ONLYOFFICE_ENABLED' => $this->configurationManager->isOnlyofficeEnabled ? 'yes' : '',
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue