Fix _APP_EXECUTOR_HOST for upgrades

As of 1.4.0, the hostname of the executor should be executor rather than
appwrite-executor. The problem is our install command always uses the
existing installation's variable values as the default for the upgrade.
This means the _APP_EXECUTOR_HOST will retain it's old value.

This PR Adds an overwrite key to variables.php to allow overwriting the
variable value regardless of whatever was in the previous installation.
This commit is contained in:
Steven Nguyen
2023-09-04 11:06:43 -07:00
parent 22745e0418
commit 3c7c44adda
2 changed files with 11 additions and 9 deletions
+1
View File
@@ -750,6 +750,7 @@ return [
'introduction' => '0.13.0',
'default' => 'http://appwrite-executor/v1',
'required' => false,
'overwrite' => true,
'question' => '',
'filter' => ''
],
+10 -9
View File
@@ -40,6 +40,7 @@ class Install extends Action
$config = Config::getParam('variables');
$defaultHTTPPort = '80';
$defaultHTTPSPort = '443';
/** @var array<string, array<string, string>> $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;
}
}
}