Skip to content

Commit a882d3c

Browse files
committed
code cleanup
1 parent 6010b32 commit a882d3c

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

app/Jobs/DatabaseBackupJob.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ private function upload_to_s3(): void
497497

498498
$this->ensureHelperImageAvailable();
499499

500+
$fullImageName = $this->getFullImageName();
500501
$commands[] = "docker run -d --network {$network} --name backup-of-{$this->backup->uuid} --rm -v $this->backup_location:$this->backup_location:ro {$fullImageName}";
501502
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc config host add temporary {$endpoint} $key $secret";
502503
$commands[] = "docker exec backup-of-{$this->backup->uuid} mc cp $this->backup_location temporary/$bucket{$this->backup_dir}/";
@@ -513,17 +514,12 @@ private function upload_to_s3(): void
513514

514515
private function ensureHelperImageAvailable(): void
515516
{
516-
$settings = InstanceSettings::get();
517-
$helperImage = config('coolify.helper_image');
518-
$latestVersion = $settings->helper_version;
519-
$fullImageName = "{$helperImage}:{$latestVersion}";
517+
$fullImageName = $this->getFullImageName();
520518

521519
$imageExists = $this->checkImageExists($fullImageName);
522520

523521
if (!$imageExists) {
524522
$this->pullHelperImage($fullImageName);
525-
} else {
526-
return;
527523
}
528524
}
529525

@@ -543,4 +539,12 @@ private function pullHelperImage(string $fullImageName): void
543539
throw new \RuntimeException($errorMessage);
544540
}
545541
}
542+
543+
private function getFullImageName(): string
544+
{
545+
$settings = InstanceSettings::get();
546+
$helperImage = config('coolify.helper_image');
547+
$latestVersion = $settings->helper_version;
548+
return "{$helperImage}:{$latestVersion}";
549+
}
546550
}

0 commit comments

Comments
 (0)