Files
coolify/app/Console/Commands/UpdateChannel.php
T
peaklabs-dev bcd165a909 feat(install): add --preview and --nightly flags to install.sh
- Once Coolify is healthy, install.sh switches the instance to that update channel with php artisan app:update-channel
- The command and the update page share the rule that keeps the updates of the old channel after a switch to a more stable one
2026-11-02 00:07:20 +01:00

44 lines
1.1 KiB
PHP

<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
class UpdateChannel extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:update-channel {channel : stable, preview or nightly}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Switch the update channel of the instance, as the update page does';
/**
* Execute the console command.
*/
public function handle(): int
{
$channel = $this->argument('channel');
if (! in_array($channel, ['stable', 'preview', 'nightly'], true)) {
$this->error("{$channel} is not an update channel, expected stable, preview or nightly");
return self::FAILURE;
}
$settings = instanceSettings();
$settings->switchUpdateChannel($channel);
$settings->save();
invalidate_versions_cache();
$this->info("The instance follows the {$channel} channel");
return self::SUCCESS;
}
}