Skip to content

Commit b00828d

Browse files
committed
chore: Refactor instanceSettings() function and improve code readability
1 parent 5a770f9 commit b00828d

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

app/Models/Service.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,7 @@ public function failedTaskLink($task_uuid)
966966
'service_uuid' => data_get($this, 'uuid'),
967967
'task_uuid' => $task_uuid,
968968
]);
969-
$settings = instanceSettings();
969+
$settings = InstanceSettings::get();
970970
if (data_get($settings, 'fqdn')) {
971971
$url = Url::fromString($route);
972972
$url = $url->withPort(null);
@@ -1095,7 +1095,22 @@ public function saveComposeConfigs()
10951095
return 3;
10961096
});
10971097
foreach ($sorted as $env) {
1098-
$commands[] = "echo '{$env->key}={$env->real_value}' >> .env";
1098+
if (version_compare($env->version, '4.0.0-beta.347', '<=')) {
1099+
$commands[] = "echo '{$env->key}={$env->real_value}' >> .env";
1100+
} else {
1101+
$real_value = $env->real_value;
1102+
if ($env->version === '4.0.0-beta.239') {
1103+
$real_value = $env->real_value;
1104+
} else {
1105+
if ($env->is_literal || $env->is_multiline) {
1106+
$real_value = '\''.$real_value.'\'';
1107+
} else {
1108+
$real_value = escapeEnvVariables($env->real_value);
1109+
}
1110+
}
1111+
ray("echo \"{$env->key}={$real_value}\" >> .env");
1112+
$commands[] = "echo \"{$env->key}={$real_value}\" >> .env";
1113+
}
10991114
}
11001115
if ($sorted->count() === 0) {
11011116
$commands[] = 'touch .env';

0 commit comments

Comments
 (0)