diff --git a/app/config/variables.php b/app/config/variables.php index b39eb9c41..8d31ee350 100644 --- a/app/config/variables.php +++ b/app/config/variables.php @@ -750,6 +750,7 @@ return [ 'introduction' => '0.13.0', 'default' => 'http://appwrite-executor/v1', 'required' => false, + 'overwrite' => true, 'question' => '', 'filter' => '' ], diff --git a/src/Appwrite/Platform/Tasks/Install.php b/src/Appwrite/Platform/Tasks/Install.php index c9ed1d733..89297a78e 100644 --- a/src/Appwrite/Platform/Tasks/Install.php +++ b/src/Appwrite/Platform/Tasks/Install.php @@ -40,6 +40,7 @@ class Install extends Action $config = Config::getParam('variables'); $defaultHTTPPort = '80'; $defaultHTTPSPort = '443'; + /** @var array> $vars array whre key is variable name and value is variable */ $vars = []; /** @@ -50,7 +51,7 @@ class Install extends Action foreach ($config as $category) { foreach ($category['variables'] ?? [] as $var) { - $vars[] = $var; + $vars[$var['name']] = $var; } } @@ -104,10 +105,10 @@ class Install extends Action if (is_null($value)) { continue; } - foreach ($vars as $i => $var) { - if ($var['name'] === $key) { - $vars[$i]['default'] = $value; - } + + $configVar = $vars[$key] ?? []; + if (!empty($configVar) && !($configVar['overwrite'] ?? false)) { + $vars[$key]['default'] = $value; } } } @@ -123,10 +124,10 @@ class Install extends Action if (is_null($value)) { continue; } - foreach ($vars as $i => $var) { - if ($var['name'] === $key) { - $vars[$i]['default'] = $value; - } + + $configVar = $vars[$key] ?? []; + if (!empty($configVar) && !($configVar['overwrite'] ?? false)) { + $vars[$key]['default'] = $value; } } }