An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
Add redis username
ayntk-aia2ba67ea34f3
diff --git a/app/Actions/Database/StartRedis.php b/app/Actions/Database/StartRedis.phpindex f10afef5e9..b3f240942f 100644--- a/app/Actions/Database/StartRedis.php+++ b/app/Actions/Database/StartRedis.php@@ -166,6 +166,14 @@ class StartRedis$environment_variables->push("$env->key=$env->real_value");}+ $redis_version = $this->get_redis_version();++ if (version_compare($redis_version, '6.0', '>=')) {+ if ($environment_variables->filter(fn ($env) => str($env)->contains('REDIS_USERNAME'))->isEmpty()) {+ $environment_variables->push("REDIS_USERNAME={$this->database->redis_username}");+ }+ }+if ($environment_variables->filter(fn ($env) => str($env)->contains('REDIS_PASSWORD'))->isEmpty()) {$environment_variables->push("REDIS_PASSWORD={$this->database->redis_password}");}@@ -173,6 +181,12 @@ class StartRedisreturn $environment_variables->all();}+ private function get_redis_version()+ {+ $image_parts = explode(':', $this->database->image);+ return $image_parts[1] ?? '0.0';+ }+private function add_custom_redis(){if (is_null($this->database->redis_conf) || empty($this->database->redis_conf)) {@@ -184,4 +198,4 @@ class StartRedisinstant_scp($path, "{$this->configuration_dir}/{$filename}", $this->database->destination->server);Storage::disk('local')->delete("tmp/redis.conf_{$this->database->uuid}");}-}+}\ No newline at end of filediff --git a/app/Livewire/Project/Database/Redis/General.php b/app/Livewire/Project/Database/Redis/General.phpindex a7ce0161ae..6acd1095fc 100644--- a/app/Livewire/Project/Database/Redis/General.php+++ b/app/Livewire/Project/Database/Redis/General.php@@ -25,6 +25,7 @@ class General extends Component'database.name' => 'required','database.description' => 'nullable','database.redis_conf' => 'nullable',+ 'database.redis_username' => 'required','database.redis_password' => 'required','database.image' => 'required','database.ports_mappings' => 'nullable',@@ -37,6 +38,7 @@ class General extends Component'database.name' => 'Name','database.description' => 'Description','database.redis_conf' => 'Redis Configuration',+ 'database.redis_username' => 'Redis Username','database.redis_password' => 'Redis Password','database.image' => 'Image','database.ports_mappings' => 'Port Mapping',@@ -73,16 +75,33 @@ class General extends Component{try {$this->validate();- if ($this->database->redis_conf === '') {- $this->database->redis_conf = null;++ $redis_version = $this->get_redis_version();++ if (version_compare($redis_version, '6.0', '>=')) {+ if ($this->database->isDirty('redis_username')) {+ $this->database->redis_username = $this->database->redis_username;+ }+ }++ if ($this->database->isDirty('redis_password')) {+ $this->database->redis_password = $this->database->redis_password;}+$this->database->save();+$this->dispatch('success', 'Database updated.');} catch (Exception $e) {return handleError($e, $this);}}+ private function get_redis_version()+ {+ $image_parts = explode(':', $this->database->image);+ return $image_parts[1] ?? '0.0';+ }+public function instantSave(){try {@@ -123,4 +142,4 @@ class General extends Component{return view('livewire.project.database.redis.general');}-}+}\ No newline at end of file