Method to set dynamic config variables for DockerActionManager->CreateContainer()

Signed-off-by: Pablo Zmdl <pablo@nextcloud.com>
This commit is contained in:
Pablo Zmdl 2026-01-06 19:11:53 +01:00
parent fa50f5c141
commit 71b898ef14
2 changed files with 12 additions and 4 deletions

View file

@ -25,6 +25,16 @@ class ConfigurationManager
return $this->config;
}
/**
* A helper for setter methods, and to allow DockerActionManager->CreateContainer() to set dynamic
* variables.
* This method must be public for the latter purpose.
*/
public function set(string $key, mixed $value) : void {
$this->GetConfig();
$this->config[$key] = $value;
}
public function GetPassword() : string {
return $this->GetConfig()['password'];
}

View file

@ -230,13 +230,11 @@ readonly class DockerActionManager {
$aioVariables = $container->GetAioVariables()->GetVariables();
foreach ($aioVariables as $variable) {
$config = $this->configurationManager->GetConfig();
$variable = $this->replaceEnvPlaceholders($variable);
$variableArray = explode('=', $variable);
$config[$variableArray[0]] = $variableArray[1];
$this->configurationManager->WriteConfig($config);
sleep(1);
$this->configurationManager->set($variableArray[0], $variableArray[1]);
}
$this->configurationManager->save();
$envs = $container->GetEnvironmentVariables()->GetVariables();
// Special thing for the nextcloud container