diff --git a/app/Models/StandaloneRedis.php b/app/Models/StandaloneRedis.php index ed5cf9870..6037364fe 100644 --- a/app/Models/StandaloneRedis.php +++ b/app/Models/StandaloneRedis.php @@ -38,6 +38,12 @@ class StandaloneRedis extends BaseModel $database->forceFill(['last_online_at' => now()]); } }); + + static::retrieved(function ($database) { + if (! $database->redis_username) { + $database->redis_username = 'default'; + } + }); } protected function serverStatus(): Attribute @@ -193,8 +199,8 @@ class StandaloneRedis extends BaseModel { return Attribute::make( get: fn () => is_null($this->ports_mappings) - ? [] - : explode(',', $this->ports_mappings), + ? [] + : explode(',', $this->ports_mappings), ); } @@ -346,7 +352,12 @@ class StandaloneRedis extends BaseModel get: function () { $username = $this->runtime_environment_variables()->where('key', 'REDIS_USERNAME')->first(); if (! $username) { - return null; + $this->runtime_environment_variables()->create([ + 'key' => 'REDIS_USERNAME', + 'value' => 'default', + ]); + + return 'default'; } return $username->value;