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
feat(EnvironmentVariable): add handling for Redis credentials in the environment variable component
Andras Bacsaid383344ab91d
diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php b/app/Livewire/Project/Shared/EnvironmentVariable/Show.phpindex 3a7d0faa57..f35a38bde9 100644--- a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php+++ b/app/Livewire/Project/Shared/EnvironmentVariable/Show.php@@ -40,6 +40,8 @@ class Show extends Componentpublic bool $is_really_required = false;+ public bool $is_redis_credential = false;+protected $listeners = ['refreshEnvs' => 'refresh','refresh',@@ -65,7 +67,9 @@ class Show extends Component}$this->parameters = get_route_parameters();$this->checkEnvs();-+ if ($this->type === 'standalone-redis' && ($this->env->key === 'REDIS_PASSWORD' || $this->env->key === 'REDIS_USERNAME')) {+ $this->is_redis_credential = true;+ }}public function refresh()@@ -171,6 +175,11 @@ class Show extends Componentpublic function delete(){try {+ if ($this->is_redis_credential) {+ $this->dispatch('error', 'Cannot delete Redis credentials.');++ return;+ }$this->env->delete();$this->dispatch('environmentVariableDeleted');$this->dispatch('success', 'Environment variable deleted successfully.');diff --git a/resources/views/livewire/project/shared/environment-variable/show.blade.php b/resources/views/livewire/project/shared/environment-variable/show.blade.phpindex e3130e805d..4d54df3bd8 100644--- a/resources/views/livewire/project/shared/environment-variable/show.blade.php+++ b/resources/views/livewire/project/shared/environment-variable/show.blade.php@@ -31,46 +31,48 @@@else<div class="flex flex-col w-full gap-2 lg:flex-row">@if ($is_multiline)- <x-forms.input isMultiline="{{ $is_multiline }}" id="key" />- <x-forms.textarea type="password" id="value" />+ <x-forms.input :required="$is_redis_credential" isMultiline="{{ $is_multiline }}" id="key" />+ <x-forms.textarea :required="$is_redis_credential" type="password" id="value" />@else- <x-forms.input id="key" />- <x-forms.input type="password" id="value" />+ <x-forms.input :disabled="$is_redis_credential" :required="$is_redis_credential" id="key" />+ <x-forms.input :required="$is_redis_credential" type="password" id="value" />@endif@if ($is_shared)- <x-forms.input disabled type="password" id="real_value" />+ <x-forms.input :disabled="$is_redis_credential" :required="$is_redis_credential" disabled type="password" id="real_value" />@endif</div>@endif<div class="flex flex-col w-full gap-2 lg:flex-row">- @if ($type === 'service')- <x-forms.checkbox instantSave id="is_build_time"- helper="If you are using Docker, remember to modify the file to be ready to receive the build time args. Ex.: for docker file, add `ARG name_of_the_variable`, or dockercompose add `- 'name_of_the_variable=${name_of_the_variable}'`"- label="Build Variable?" />- <x-forms.checkbox instantSave id="is_literal"- helper="This means that when you use $VARIABLES in a value, it should be interpreted as the actual characters '$VARIABLES' and not as the value of a variable named VARIABLE.<br><br>Useful if you have $ sign in your value and there are some characters after it, but you would not like to interpolate it from another value. In this case, you should set this to true."- label="Is Literal?" />- <x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" />- @else- @if ($is_shared)+ @if (!$is_redis_credential)+ @if ($type === 'service')<x-forms.checkbox instantSave id="is_build_time"helper="If you are using Docker, remember to modify the file to be ready to receive the build time args. Ex.: for docker file, add `ARG name_of_the_variable`, or dockercompose add `- 'name_of_the_variable=${name_of_the_variable}'`"label="Build Variable?" /><x-forms.checkbox instantSave id="is_literal"helper="This means that when you use $VARIABLES in a value, it should be interpreted as the actual characters '$VARIABLES' and not as the value of a variable named VARIABLE.<br><br>Useful if you have $ sign in your value and there are some characters after it, but you would not like to interpolate it from another value. In this case, you should set this to true."label="Is Literal?" />+ <x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" />@else- @if ($isSharedVariable)- <x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" />- @else+ @if ($is_shared)<x-forms.checkbox instantSave id="is_build_time"- helper="If you are using Docker, remember to modify the file to be ready to receive the build time args. Ex.: for dockerfile, add `ARG name_of_the_variable`, or dockercompose add `- 'name_of_the_variable=${name_of_the_variable}'`"+ helper="If you are using Docker, remember to modify the file to be ready to receive the build time args. Ex.: for docker file, add `ARG name_of_the_variable`, or dockercompose add `- 'name_of_the_variable=${name_of_the_variable}'`"label="Build Variable?" />- <x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" />- @if ($is_multiline === false)- <x-forms.checkbox instantSave id="is_literal"- helper="This means that when you use $VARIABLES in a value, it should be interpreted as the actual characters '$VARIABLES' and not as the value of a variable named VARIABLE.<br><br>Useful if you have $ sign in your value and there are some characters after it, but you would not like to interpolate it from another value. In this case, you should set this to true."- label="Is Literal?" />+ <x-forms.checkbox instantSave id="is_literal"+ helper="This means that when you use $VARIABLES in a value, it should be interpreted as the actual characters '$VARIABLES' and not as the value of a variable named VARIABLE.<br><br>Useful if you have $ sign in your value and there are some characters after it, but you would not like to interpolate it from another value. In this case, you should set this to true."+ label="Is Literal?" />+ @else+ @if ($isSharedVariable)+ <x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" />+ @else+ <x-forms.checkbox instantSave id="is_build_time"+ helper="If you are using Docker, remember to modify the file to be ready to receive the build time args. Ex.: for dockerfile, add `ARG name_of_the_variable`, or dockercompose add `- 'name_of_the_variable=${name_of_the_variable}'`"+ label="Build Variable?" />+ <x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" />+ @if ($is_multiline === false)+ <x-forms.checkbox instantSave id="is_literal"+ helper="This means that when you use $VARIABLES in a value, it should be interpreted as the actual characters '$VARIABLES' and not as the value of a variable named VARIABLE.<br><br>Useful if you have $ sign in your value and there are some characters after it, but you would not like to interpolate it from another value. In this case, you should set this to true."+ label="Is Literal?" />+ @endif@endif@endif@endif