fix: compose env has SERVICE, but not defined for Coolify
This commit is contained in:
parent
93af92743c
commit
ca9a2cb13a
@ -1005,6 +1005,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
'service_id' => $resource->id,
|
'service_id' => $resource->id,
|
||||||
])->first();
|
])->first();
|
||||||
['command' => $command, 'forService' => $forService, 'generatedValue' => $generatedValue, 'port' => $port] = parseEnvVariable($value);
|
['command' => $command, 'forService' => $forService, 'generatedValue' => $generatedValue, 'port' => $port] = parseEnvVariable($value);
|
||||||
|
if (!is_null($command)) {
|
||||||
if ($command?->value() === 'FQDN' || $command?->value() === 'URL') {
|
if ($command?->value() === 'FQDN' || $command?->value() === 'URL') {
|
||||||
if (Str::lower($forService) === $serviceName) {
|
if (Str::lower($forService) === $serviceName) {
|
||||||
$fqdn = generateFqdn($resource->server, $containerName);
|
$fqdn = generateFqdn($resource->server, $containerName);
|
||||||
@ -1062,6 +1063,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($value->contains(':-')) {
|
if ($value->contains(':-')) {
|
||||||
$key = $value->before(':');
|
$key = $value->before(':');
|
||||||
@ -1471,6 +1473,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
'application_id' => $resource->id,
|
'application_id' => $resource->id,
|
||||||
])->first();
|
])->first();
|
||||||
['command' => $command, 'forService' => $forService, 'generatedValue' => $generatedValue, 'port' => $port] = parseEnvVariable($value);
|
['command' => $command, 'forService' => $forService, 'generatedValue' => $generatedValue, 'port' => $port] = parseEnvVariable($value);
|
||||||
|
if (!is_null($command)) {
|
||||||
if ($command?->value() === 'FQDN' || $command?->value() === 'URL') {
|
if ($command?->value() === 'FQDN' || $command?->value() === 'URL') {
|
||||||
if (Str::lower($forService) === $serviceName) {
|
if (Str::lower($forService) === $serviceName) {
|
||||||
$fqdn = generateFqdn($server, $containerName);
|
$fqdn = generateFqdn($server, $containerName);
|
||||||
@ -1483,7 +1486,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
if ($foundEnv) {
|
if ($foundEnv) {
|
||||||
$fqdn = data_get($foundEnv, 'value');
|
$fqdn = data_get($foundEnv, 'value');
|
||||||
} else {
|
} else {
|
||||||
if ($command->value() === 'URL') {
|
if ($command?->value() === 'URL') {
|
||||||
$fqdn = Str::of($fqdn)->after('://')->value();
|
$fqdn = Str::of($fqdn)->after('://')->value();
|
||||||
}
|
}
|
||||||
EnvironmentVariable::create([
|
EnvironmentVariable::create([
|
||||||
@ -1506,6 +1509,7 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($value->contains(':-')) {
|
if ($value->contains(':-')) {
|
||||||
$key = $value->before(':');
|
$key = $value->before(':');
|
||||||
@ -1655,7 +1659,7 @@ function parseEnvVariable(Str|string $value)
|
|||||||
$forService = null;
|
$forService = null;
|
||||||
$generatedValue = null;
|
$generatedValue = null;
|
||||||
$port = null;
|
$port = null;
|
||||||
|
if ($value->startsWith('SERVICE')) {
|
||||||
if ($count === 2) {
|
if ($count === 2) {
|
||||||
if ($value->startsWith('SERVICE_FQDN') || $value->startsWith('SERVICE_URL')) {
|
if ($value->startsWith('SERVICE_FQDN') || $value->startsWith('SERVICE_URL')) {
|
||||||
// SERVICE_FQDN_UMAMI
|
// SERVICE_FQDN_UMAMI
|
||||||
@ -1680,6 +1684,7 @@ function parseEnvVariable(Str|string $value)
|
|||||||
$command = $value->after('SERVICE_')->beforeLast('_');
|
$command = $value->after('SERVICE_')->beforeLast('_');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return [
|
return [
|
||||||
'command' => $command,
|
'command' => $command,
|
||||||
'forService' => $forService,
|
'forService' => $forService,
|
||||||
|
Loading…
Reference in New Issue
Block a user