fix(ui): skip SERVICE_FQDN and SERVICE_URL variables during update
This commit is contained in:
@@ -138,6 +138,7 @@ class All extends Component
|
|||||||
private function handleBulkSubmit()
|
private function handleBulkSubmit()
|
||||||
{
|
{
|
||||||
$variables = parseEnvFormatToArray($this->variables);
|
$variables = parseEnvFormatToArray($this->variables);
|
||||||
|
|
||||||
$this->deleteRemovedVariables(false, $variables);
|
$this->deleteRemovedVariables(false, $variables);
|
||||||
$this->updateOrCreateVariables(false, $variables);
|
$this->updateOrCreateVariables(false, $variables);
|
||||||
|
|
||||||
@@ -189,6 +190,9 @@ class All extends Component
|
|||||||
private function updateOrCreateVariables($isPreview, $variables)
|
private function updateOrCreateVariables($isPreview, $variables)
|
||||||
{
|
{
|
||||||
foreach ($variables as $key => $value) {
|
foreach ($variables as $key => $value) {
|
||||||
|
if (str($key)->startsWith('SERVICE_FQDN') || str($key)->startsWith('SERVICE_URL')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$method = $isPreview ? 'environment_variables_preview' : 'environment_variables';
|
$method = $isPreview ? 'environment_variables_preview' : 'environment_variables';
|
||||||
$found = $this->resource->$method()->where('key', $key)->first();
|
$found = $this->resource->$method()->where('key', $key)->first();
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
</x-modal-input>
|
</x-modal-input>
|
||||||
</div>
|
</div>
|
||||||
<x-forms.button
|
<x-forms.button
|
||||||
wire:click='switch'>{{ $view === 'normal' ? 'Developer view' : 'Normal view (required to set variables at build time)' }}</x-forms.button>
|
wire:click='switch'>{{ $view === 'normal' ? 'Developer view' : 'Normal view' }}</x-forms.button>
|
||||||
</div>
|
</div>
|
||||||
<div>Environment variables (secrets) for this resource. </div>
|
<div>Environment variables (secrets) for this resource. </div>
|
||||||
@if ($this->resourceClass === 'App\Models\Application' && data_get($this->resource, 'build_pack') !== 'dockercompose')
|
@if ($this->resourceClass === 'App\Models\Application' && data_get($this->resource, 'build_pack') !== 'dockercompose')
|
||||||
@@ -41,9 +41,9 @@
|
|||||||
$requiredEmptyVars = $resource->environment_variables->filter(function ($env) {
|
$requiredEmptyVars = $resource->environment_variables->filter(function ($env) {
|
||||||
return $env->is_required && empty($env->value);
|
return $env->is_required && empty($env->value);
|
||||||
});
|
});
|
||||||
|
|
||||||
$otherVars = $resource->environment_variables->diff($requiredEmptyVars);
|
$otherVars = $resource->environment_variables->diff($requiredEmptyVars);
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@forelse ($requiredEmptyVars->merge($otherVars) as $env)
|
@forelse ($requiredEmptyVars->merge($otherVars) as $env)
|
||||||
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
|
<livewire:project.shared.environment-variable.show wire:key="environment-{{ $env->id }}"
|
||||||
:env="$env" :type="$resource->type()" />
|
:env="$env" :type="$resource->type()" />
|
||||||
|
|||||||
Reference in New Issue
Block a user