From 71b898ef14f686f33d21537297e028e6662f3771 Mon Sep 17 00:00:00 2001 From: Pablo Zmdl Date: Tue, 6 Jan 2026 19:11:53 +0100 Subject: [PATCH] Method to set dynamic config variables for DockerActionManager->CreateContainer() Signed-off-by: Pablo Zmdl --- php/src/Data/ConfigurationManager.php | 10 ++++++++++ php/src/Docker/DockerActionManager.php | 6 ++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index e2bea55d..74a5b2eb 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -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']; } diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 9e8a8ff2..c32b7544 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -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