fix(parser): enable gzip compression conditionally for Pocketbase images and streamline service creation logic
This commit is contained in:
@@ -2991,12 +2991,6 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
|||||||
$applicationFound = ServiceApplication::where('name', $serviceName)->where('service_id', $resource->id)->first();
|
$applicationFound = ServiceApplication::where('name', $serviceName)->where('service_id', $resource->id)->first();
|
||||||
if ($applicationFound) {
|
if ($applicationFound) {
|
||||||
$savedService = $applicationFound;
|
$savedService = $applicationFound;
|
||||||
// $savedService = ServiceDatabase::firstOrCreate([
|
|
||||||
// 'name' => $applicationFound->name,
|
|
||||||
// 'image' => $applicationFound->image,
|
|
||||||
// 'service_id' => $applicationFound->service_id,
|
|
||||||
// ]);
|
|
||||||
// $applicationFound->delete();
|
|
||||||
} else {
|
} else {
|
||||||
$savedService = ServiceDatabase::firstOrCreate([
|
$savedService = ServiceDatabase::firstOrCreate([
|
||||||
'name' => $serviceName,
|
'name' => $serviceName,
|
||||||
@@ -3007,15 +3001,23 @@ function newParser(Application|Service $resource, int $pull_request_id = 0, ?int
|
|||||||
$savedService = ServiceApplication::firstOrCreate([
|
$savedService = ServiceApplication::firstOrCreate([
|
||||||
'name' => $serviceName,
|
'name' => $serviceName,
|
||||||
'service_id' => $resource->id,
|
'service_id' => $resource->id,
|
||||||
|
], [
|
||||||
|
'is_gzip_enabled' => true,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if image changed
|
// Check if image changed
|
||||||
if ($savedService->image !== $image) {
|
if ($savedService->image !== $image) {
|
||||||
$savedService->image = $image;
|
$savedService->image = $image;
|
||||||
$savedService->save();
|
$savedService->save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Pocketbase does not need gzip for SSE.
|
||||||
|
if (str($savedService->image)->contains('pocketbase') && $savedService->is_gzip_enabled) {
|
||||||
|
$savedService->is_gzip_enabled = false;
|
||||||
|
$savedService->save();
|
||||||
|
}
|
||||||
|
|
||||||
$environment = collect(data_get($service, 'environment', []));
|
$environment = collect(data_get($service, 'environment', []));
|
||||||
$buildArgs = collect(data_get($service, 'build.args', []));
|
$buildArgs = collect(data_get($service, 'build.args', []));
|
||||||
$environment = $environment->merge($buildArgs);
|
$environment = $environment->merge($buildArgs);
|
||||||
|
|||||||
Reference in New Issue
Block a user