Files
nix/packages/docker/nextcloud/declarative-secrets.patch
Nikolaos Karaolidis f819c8c5e3 Add nextcloud
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-06-16 00:40:24 +01:00

35 lines
1.1 KiB
Diff

diff --git a/lib/private/Setup.php b/lib/private/Setup.php
index 271e10d6..d21e2dd6 100644
--- a/lib/private/Setup.php
+++ b/lib/private/Setup.php
@@ -272,21 +272,22 @@ class Setup {
$dbType = 'sqlite3';
}
- //generate a random salt that is used to salt the local passwords
- $salt = $this->random->generate(30);
- // generate a secret
- $secret = $this->random->generate(48);
-
//write the config file
$newConfigValues = [
- 'passwordsalt' => $salt,
- 'secret' => $secret,
'trusted_domains' => $trustedDomains,
'datadirectory' => $dataDir,
'dbtype' => $dbType,
'version' => implode('.', \OCP\Util::getVersion()),
];
+ if ($this->config->getValue('passwordsalt', null) === null) {
+ $newConfigValues['passwordsalt'] = $this->random->generate(30);
+ }
+
+ if ($this->config->getValue('secret', null) === null) {
+ $newConfigValues['secret'] = $this->random->generate(48);
+ }
+
if ($this->config->getValue('overwrite.cli.url', null) === null) {
$newConfigValues['overwrite.cli.url'] = $request->getServerProtocol() . '://' . $request->getInsecureServerHost() . \OC::$WEBROOT;
}