mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-02-04 04:56:52 +00:00
Adapt GetEnvironmentalVariableOrConfig() to get() and set()
Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
parent
4b011369ae
commit
9be2c36a6b
1 changed files with 10 additions and 12 deletions
|
|
@ -654,23 +654,21 @@ class ConfigurationManager
|
||||||
|
|
||||||
private function GetEnvironmentalVariableOrConfig(string $envVariableName, string $configName, string $defaultValue) : string {
|
private function GetEnvironmentalVariableOrConfig(string $envVariableName, string $configName, string $defaultValue) : string {
|
||||||
$envVariableOutput = getenv($envVariableName);
|
$envVariableOutput = getenv($envVariableName);
|
||||||
|
$configValue = $this->get($configName, '');
|
||||||
if ($envVariableOutput === false) {
|
if ($envVariableOutput === false) {
|
||||||
$config = $this->GetConfig();
|
if ($configValue === '') {
|
||||||
if (!isset($config[$configName]) || $config[$configName] === '') {
|
$this->set($configName, $defaultValue);
|
||||||
$config[$configName] = $defaultValue;
|
return $defaultValue;
|
||||||
}
|
}
|
||||||
return $config[$configName];
|
return $configValue;
|
||||||
}
|
}
|
||||||
if(file_exists(DataConst::GetConfigFile())) {
|
|
||||||
$config = $this->GetConfig();
|
if (file_exists(DataConst::GetConfigFile())) {
|
||||||
if (!isset($config[$configName])) {
|
if ($envVariableOutput !== $configValue) {
|
||||||
$config[$configName] = '';
|
$this->set($configName, $envVariableOutput);
|
||||||
}
|
|
||||||
if ($envVariableOutput !== $config[$configName]) {
|
|
||||||
$config[$configName] = $envVariableOutput;
|
|
||||||
$this->WriteConfig($config);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $envVariableOutput;
|
return $envVariableOutput;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue