fix(parser): improve FQDN generation and update environment variable handling
This commit is contained in:
@@ -3060,12 +3060,18 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
|||||||
$port = null;
|
$port = null;
|
||||||
}
|
}
|
||||||
if ($isApplication) {
|
if ($isApplication) {
|
||||||
$fqdn = generateFqdn($server, "$uuid");
|
$fqdn = $resource->fqdn;
|
||||||
|
if (blank($resource->fqdn)) {
|
||||||
|
$fqdn = generateFqdn($server, "$uuid");
|
||||||
|
}
|
||||||
} elseif ($isService) {
|
} elseif ($isService) {
|
||||||
if ($fqdnFor) {
|
$fqdn = $savedService->fqdn;
|
||||||
$fqdn = generateFqdn($server, "$fqdnFor-$uuid");
|
if (blank($savedService->fqdn)) {
|
||||||
} else {
|
if ($fqdnFor) {
|
||||||
$fqdn = generateFqdn($server, "{$savedService->name}-$uuid");
|
$fqdn = generateFqdn($server, "$fqdnFor-$uuid");
|
||||||
|
} else {
|
||||||
|
$fqdn = generateFqdn($server, "{$savedService->name}-$uuid");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3090,7 +3096,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (substr_count(str($key)->value(), '_') === 2) {
|
if (substr_count(str($key)->value(), '_') === 2) {
|
||||||
$resource->environment_variables()->firstOrCreate([
|
$resource->environment_variables()->updateOrCreate([
|
||||||
'key' => $key->value(),
|
'key' => $key->value(),
|
||||||
'resourceable_type' => get_class($resource),
|
'resourceable_type' => get_class($resource),
|
||||||
'resourceable_id' => $resource->id,
|
'resourceable_id' => $resource->id,
|
||||||
@@ -3102,7 +3108,7 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
|||||||
}
|
}
|
||||||
if (substr_count(str($key)->value(), '_') === 3) {
|
if (substr_count(str($key)->value(), '_') === 3) {
|
||||||
$newKey = str($key)->beforeLast('_');
|
$newKey = str($key)->beforeLast('_');
|
||||||
$resource->environment_variables()->firstOrCreate([
|
$resource->environment_variables()->updateOrCreate([
|
||||||
'key' => $newKey->value(),
|
'key' => $newKey->value(),
|
||||||
'resourceable_type' => get_class($resource),
|
'resourceable_type' => get_class($resource),
|
||||||
'resourceable_id' => $resource->id,
|
'resourceable_id' => $resource->id,
|
||||||
|
Reference in New Issue
Block a user