fix: add 'is_literal' flag to shared environment variables for servers

This commit is contained in:
Andras Bacsai 2026-01-02 17:46:39 +01:00
parent 99d22ae7d6
commit 510fb2256b
3 changed files with 9 additions and 4 deletions

View file

@ -19,7 +19,6 @@
use App\Traits\HasSafeStringAttribute;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Casts\Attribute;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Carbon;
@ -169,7 +168,7 @@ protected static function booted()
$standaloneDocker->saveQuietly();
}
}
if (! isset($server->proxy->redirect_enabled)) {
if (! isset($server->proxy->redirect_enabled)) {
$server->proxy->redirect_enabled = true;
}
@ -180,6 +179,7 @@ protected static function booted()
'type' => 'server',
'server_id' => $server->id,
'team_id' => $server->team_id,
'is_literal' => true,
]);
SharedEnvironmentVariable::create([
'key' => 'COOLIFY_SERVER_NAME',
@ -187,6 +187,7 @@ protected static function booted()
'type' => 'server',
'server_id' => $server->id,
'team_id' => $server->team_id,
'is_literal' => true,
]);
});
static::retrieved(function ($server) {

View file

@ -21,13 +21,14 @@ public function up(): void
->where('key', 'COOLIFY_SERVER_UUID')
->exists();
if (!$uuidExists) {
if (! $uuidExists) {
DB::table('shared_environment_variables')->insert([
'key' => 'COOLIFY_SERVER_UUID',
'value' => $server->uuid,
'type' => 'server',
'server_id' => $server->id,
'team_id' => $server->team_id,
'is_literal' => true,
'created_at' => now(),
'updated_at' => now(),
]);
@ -40,13 +41,14 @@ public function up(): void
->where('key', 'COOLIFY_SERVER_NAME')
->exists();
if (!$nameExists) {
if (! $nameExists) {
DB::table('shared_environment_variables')->insert([
'key' => 'COOLIFY_SERVER_NAME',
'value' => $server->name,
'type' => 'server',
'server_id' => $server->id,
'team_id' => $server->team_id,
'is_literal' => true,
'created_at' => now(),
'updated_at' => now(),
]);

View file

@ -44,6 +44,7 @@ public function run(): void
'team_id' => $server->team_id,
], [
'value' => $server->uuid,
'is_literal' => true,
]);
SharedEnvironmentVariable::firstOrCreate([
@ -53,6 +54,7 @@ public function run(): void
'team_id' => $server->team_id,
], [
'value' => $server->name,
'is_literal' => true,
]);
}
}