feat(EnvironmentVariable): add handling for Redis credentials in the environment variable component
This commit is contained in:
@@ -40,6 +40,8 @@ class Show extends Component
|
|||||||
|
|
||||||
public bool $is_really_required = false;
|
public bool $is_really_required = false;
|
||||||
|
|
||||||
|
public bool $is_redis_credential = false;
|
||||||
|
|
||||||
protected $listeners = [
|
protected $listeners = [
|
||||||
'refreshEnvs' => 'refresh',
|
'refreshEnvs' => 'refresh',
|
||||||
'refresh',
|
'refresh',
|
||||||
@@ -65,7 +67,9 @@ class Show extends Component
|
|||||||
}
|
}
|
||||||
$this->parameters = get_route_parameters();
|
$this->parameters = get_route_parameters();
|
||||||
$this->checkEnvs();
|
$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()
|
public function refresh()
|
||||||
@@ -171,6 +175,11 @@ class Show extends Component
|
|||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
if ($this->is_redis_credential) {
|
||||||
|
$this->dispatch('error', 'Cannot delete Redis credentials.');
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
$this->env->delete();
|
$this->env->delete();
|
||||||
$this->dispatch('environmentVariableDeleted');
|
$this->dispatch('environmentVariableDeleted');
|
||||||
$this->dispatch('success', 'Environment variable deleted successfully.');
|
$this->dispatch('success', 'Environment variable deleted successfully.');
|
||||||
|
@@ -31,46 +31,48 @@
|
|||||||
@else
|
@else
|
||||||
<div class="flex flex-col w-full gap-2 lg:flex-row">
|
<div class="flex flex-col w-full gap-2 lg:flex-row">
|
||||||
@if ($is_multiline)
|
@if ($is_multiline)
|
||||||
<x-forms.input isMultiline="{{ $is_multiline }}" id="key" />
|
<x-forms.input :required="$is_redis_credential" isMultiline="{{ $is_multiline }}" id="key" />
|
||||||
<x-forms.textarea type="password" id="value" />
|
<x-forms.textarea :required="$is_redis_credential" type="password" id="value" />
|
||||||
@else
|
@else
|
||||||
<x-forms.input id="key" />
|
<x-forms.input :disabled="$is_redis_credential" :required="$is_redis_credential" id="key" />
|
||||||
<x-forms.input type="password" id="value" />
|
<x-forms.input :required="$is_redis_credential" type="password" id="value" />
|
||||||
@endif
|
@endif
|
||||||
@if ($is_shared)
|
@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
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
<div class="flex flex-col w-full gap-2 lg:flex-row">
|
<div class="flex flex-col w-full gap-2 lg:flex-row">
|
||||||
@if ($type === 'service')
|
@if (!$is_redis_credential)
|
||||||
<x-forms.checkbox instantSave id="is_build_time"
|
@if ($type === 'service')
|
||||||
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)
|
|
||||||
<x-forms.checkbox instantSave id="is_build_time"
|
<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}'`"
|
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?" />
|
label="Build Variable?" />
|
||||||
<x-forms.checkbox instantSave id="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."
|
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?" />
|
label="Is Literal?" />
|
||||||
|
<x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" />
|
||||||
@else
|
@else
|
||||||
@if ($isSharedVariable)
|
@if ($is_shared)
|
||||||
<x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" />
|
|
||||||
@else
|
|
||||||
<x-forms.checkbox instantSave id="is_build_time"
|
<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?" />
|
label="Build Variable?" />
|
||||||
<x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" />
|
<x-forms.checkbox instantSave id="is_literal"
|
||||||
@if ($is_multiline === false)
|
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."
|
||||||
<x-forms.checkbox instantSave id="is_literal"
|
label="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."
|
@else
|
||||||
label="Is Literal?" />
|
@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
|
@endif
|
||||||
@endif
|
@endif
|
||||||
|
Reference in New Issue
Block a user