mirror of
https://github.com/tiennm99/coolify.git
synced 2026-10-20 00:15:06 +00:00
fix: pull latest service-templates.json on init
This commit is contained in:
1 parent
055c613ba5
commit
290cb45726
1 file changed
+20
-5
@@ -57,12 +57,19 @@ class Init extends Command
|
|||||||
$this->call('cleanup:stucked-resources');
|
$this->call('cleanup:stucked-resources');
|
||||||
|
|
||||||
if (isCloud()) {
|
if (isCloud()) {
|
||||||
$response = Http::retry(3, 1000)->get(config('constants.services.official'));
|
try {
|
||||||
if ($response->successful()) {
|
$this->pullTemplatesFromCDN();
|
||||||
$services = $response->json();
|
} catch (\Throwable $e) {
|
||||||
File::put(base_path('templates/service-templates.json'), json_encode($services));
|
echo "Could not pull templates from CDN: {$e->getMessage()}\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! isCloud()) {
|
||||||
|
try {
|
||||||
|
$this->pullTemplatesFromCDN();
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
echo "Could not pull templates from CDN: {$e->getMessage()}\n";
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
try {
|
try {
|
||||||
$localhost = $this->servers->where('id', 0)->first();
|
$localhost = $this->servers->where('id', 0)->first();
|
||||||
$localhost->setupDynamicProxyConfiguration();
|
$localhost->setupDynamicProxyConfiguration();
|
||||||
@@ -80,6 +87,14 @@ class Init extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function pullTemplatesFromCDN()
|
||||||
|
{
|
||||||
|
$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));
|
||||||
|
}
|
||||||
|
}
|
||||||
// private function disable_metrics()
|
// private function disable_metrics()
|
||||||
// {
|
// {
|
||||||
// if (version_compare('4.0.0-beta.312', config('version'), '<=')) {
|
// if (version_compare('4.0.0-beta.312', config('version'), '<=')) {
|
||||||
|
|||||||
Reference in new issue
Block a user