fix: env variable in value parsed

This commit is contained in:
Andras Bacsai 2024-09-04 14:33:16 +02:00
parent ba90a52344
commit bfeaae9caa
4 changed files with 8 additions and 3 deletions

View File

@ -43,6 +43,7 @@ public function saveEditedCompose()
{ {
$this->dispatch('info', 'Saving new docker compose...'); $this->dispatch('info', 'Saving new docker compose...');
$this->dispatch('saveCompose', $this->service->docker_compose_raw); $this->dispatch('saveCompose', $this->service->docker_compose_raw);
$this->dispatch('refreshStorages');
} }
public function instantSave() public function instantSave()

View File

@ -24,6 +24,7 @@ class All extends Component
protected $listeners = [ protected $listeners = [
'saveKey' => 'submit', 'saveKey' => 'submit',
'refreshEnvs',
'environmentVariableDeleted' => 'refreshEnvs', 'environmentVariableDeleted' => 'refreshEnvs',
]; ];
@ -61,7 +62,7 @@ public function sortEnvironmentVariables()
$sortBy = data_get($this->resource, 'settings.is_env_sorting_enabled') ? 'key' : 'order'; $sortBy = data_get($this->resource, 'settings.is_env_sorting_enabled') ? 'key' : 'order';
$sortFunction = function ($variables) use ($sortBy) { $sortFunction = function ($variables) use ($sortBy) {
if (!$variables) { if (! $variables) {
return $variables; return $variables;
} }
if ($sortBy === 'key') { if ($sortBy === 'key') {

View File

@ -3331,7 +3331,10 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
foreach ($normalEnvironments as $key => $value) { foreach ($normalEnvironments as $key => $value) {
$key = str($key); $key = str($key);
$value = str($value); $value = str($value);
if ($value->startsWith('$')) { if ($value->startsWith('$') || $value->contains('${')) {
if ($value->contains('${')) {
$value = $value->after('${')->before('}');
}
$value = str(replaceVariables(str($value))); $value = str(replaceVariables(str($value)));
if ($value->contains(':-')) { if ($value->contains(':-')) {
$key = $value->before(':'); $key = $value->before(':');