diff --git a/app/Console/Commands/Generate/Services.php b/app/Console/Commands/Generate/Services.php index 577e94ac8..3dd30e2b8 100644 --- a/app/Console/Commands/Generate/Services.php +++ b/app/Console/Commands/Generate/Services.php @@ -16,7 +16,7 @@ class Services extends Command /** * {@inheritdoc} */ - protected $description = 'Generate service-templates.yaml based on /templates/compose directory'; + protected $description = 'Generates service-templates json file based on /templates/compose directory'; public function handle(): int { @@ -33,7 +33,7 @@ class Services extends Command ]; })->toJson(JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES); - file_put_contents(base_path('templates/service-templates.json'), $serviceTemplatesJson.PHP_EOL); + file_put_contents(base_path('templates/'.config('constants.services.file_name')), $serviceTemplatesJson.PHP_EOL); return self::SUCCESS; } diff --git a/app/Console/Commands/Init.php b/app/Console/Commands/Init.php index 1a7c0911f..f1cdd2998 100644 --- a/app/Console/Commands/Init.php +++ b/app/Console/Commands/Init.php @@ -105,7 +105,7 @@ class Init extends Command $response = Http::retry(3, 1000)->get(config('constants.services.official')); if ($response->successful()) { $services = $response->json(); - File::put(base_path('templates/service-templates.json'), json_encode($services)); + File::put(base_path('templates/'.config('constants.services.file_name')), json_encode($services)); } } diff --git a/app/Console/Commands/SyncBunny.php b/app/Console/Commands/SyncBunny.php index df1903828..6581bb587 100644 --- a/app/Console/Commands/SyncBunny.php +++ b/app/Console/Commands/SyncBunny.php @@ -45,7 +45,7 @@ class SyncBunny extends Command $install_script = 'install.sh'; $upgrade_script = 'upgrade.sh'; $production_env = '.env.production'; - $service_template = 'service-templates.json'; + $service_template = config('constants.services.file_name'); $versions = 'versions.json'; $compose_file_location = "$parent_dir/$compose_file"; @@ -102,7 +102,7 @@ class SyncBunny extends Command } } if ($only_template) { - $this->info('About to sync service-templates.json to BunnyCDN.'); + $this->info('About to sync '.config('constants.services.file_name').' to BunnyCDN.'); $confirmed = confirm('Are you sure you want to sync?'); if (! $confirmed) { return; diff --git a/app/Jobs/PullTemplatesFromCDN.php b/app/Jobs/PullTemplatesFromCDN.php index 9a4c991bc..7e6b2e21a 100644 --- a/app/Jobs/PullTemplatesFromCDN.php +++ b/app/Jobs/PullTemplatesFromCDN.php @@ -31,7 +31,7 @@ class PullTemplatesFromCDN implements ShouldBeEncrypted, ShouldQueue $response = Http::retry(3, 1000)->get(config('constants.services.official')); if ($response->successful()) { $services = $response->json(); - File::put(base_path('templates/service-templates.json'), json_encode($services)); + File::put(base_path('templates/'.config('constants.services.file_name')), json_encode($services)); } else { send_internal_notification('PullTemplatesAndVersions failed with: '.$response->status().' '.$response->body()); } diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php index 624e0b0d1..964386e4c 100644 --- a/bootstrap/helpers/shared.php +++ b/bootstrap/helpers/shared.php @@ -471,12 +471,12 @@ function get_service_templates(bool $force = false): Collection return collect($services); } catch (\Throwable) { - $services = File::get(base_path('templates/service-templates.json')); + $services = File::get(base_path('templates/'.config('constants.services.file_name'))); return collect(json_decode($services))->sortKeys(); } } else { - $services = File::get(base_path('templates/service-templates.json')); + $services = File::get(base_path('templates/'.config('constants.services.file_name'))); return collect(json_decode($services))->sortKeys(); } diff --git a/config/constants.php b/config/constants.php index c7a36d311..ed0fdf174 100644 --- a/config/constants.php +++ b/config/constants.php @@ -22,7 +22,8 @@ return [ 'services' => [ // Temporary disabled until cache is implemented // 'official' => 'https://cdn.coollabs.io/coolify/service-templates.json', - 'official' => 'https://raw.githubusercontent.com/coollabsio/coolify/main/templates/service-templates.json', + 'official' => 'https://raw.githubusercontent.com/coollabsio/coolify/main/templates/service-templates-latest.json', + 'file_name' => 'service-templates-latest.json', ], 'terminal' => [ diff --git a/resources/views/livewire/project/service/stack-form.blade.php b/resources/views/livewire/project/service/stack-form.blade.php index 8f86d4340..7583cabaf 100644 --- a/resources/views/livewire/project/service/stack-form.blade.php +++ b/resources/views/livewire/project/service/stack-form.blade.php @@ -2,6 +2,9 @@

Service Stack

+ @if (isDev()) +
{{ $service->compose_parsing_version }}
+ @endif Save @@ -25,12 +28,12 @@ @foreach ($fields as $serviceName => $field)
{{ data_get($field, 'serviceName') }}{{ data_get($field, 'name') }} - @if (data_get($field, 'customHelper')) - - @else - - @endif -
+ @if (data_get($field, 'customHelper')) + + @else + + @endif +