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
Merge remote-tracking branch 'origin/next' into audit-policies
Andras Bacsai7154febf3250
diff --cc app/Livewire/Project/Shared/EnvironmentVariable/All.phpindex 766e2a9b9b,f250a860b8..a69a41d901--- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php+++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php@@@ -86,23 -86,65 +86,79 @@@ class All extends Componen$query->orderBy('order');}- return $query->get();+ return $this->nullLockedValues($query->get());+ }++ private function nullLockedValues($envs)+ {+ $isMember = auth()->user()?->isMember();++ $envs->each(function ($env) use ($isMember) {+ if ($env->is_shown_once || $isMember) {+ $env->value = null;+ $env->real_value = null;+ }+ });++ return $envs;}+ public function getHardcodedEnvironmentVariablesProperty()+ {+ return $this->getHardcodedVariables(false);+ }++ public function getHardcodedEnvironmentVariablesPreviewProperty()+ {+ return $this->getHardcodedVariables(true);+ }++ protected function getHardcodedVariables(bool $isPreview)+ {+ // Only for services and docker-compose applications+ if ($this->resource->type() !== 'service' &&+ ($this->resourceClass !== 'App\Models\Application' ||+ ($this->resourceClass === 'App\Models\Application' && $this->resource->build_pack !== 'dockercompose'))) {+ return collect([]);+ }++ $dockerComposeRaw = $this->resource->docker_compose_raw ?? $this->resource->docker_compose;++ if (blank($dockerComposeRaw)) {+ return collect([]);+ }++ // Extract all hard-coded variables+ $hardcodedVars = extractHardcodedEnvironmentVariables($dockerComposeRaw);++ // Filter out magic variables (SERVICE_FQDN_*, SERVICE_URL_*, SERVICE_NAME_*)+ $hardcodedVars = $hardcodedVars->filter(function ($var) {+ $key = $var['key'];++ return ! str($key)->startsWith(['SERVICE_FQDN_', 'SERVICE_URL_', 'SERVICE_NAME_']);+ });++ // Filter out variables that exist in database (user has overridden/managed them)+ // For preview, check against preview variables; for production, check against production variables+ if ($isPreview) {+ $managedKeys = $this->resource->environment_variables_preview()->pluck('key')->toArray();+ } else {+ $managedKeys = $this->resource->environment_variables()->where('is_preview', false)->pluck('key')->toArray();+ }++ $hardcodedVars = $hardcodedVars->filter(function ($var) use ($managedKeys) {+ return ! in_array($var['key'], $managedKeys);+ });++ // Apply sorting based on is_env_sorting_enabled+ if ($this->is_env_sorting_enabled) {+ $hardcodedVars = $hardcodedVars->sortBy('key')->values();+ }+ // Otherwise keep order from docker-compose file++ return $hardcodedVars;+ }+public function getDevView(){$this->variables = $this->formatEnvironmentVariables($this->environmentVariables);diff --cc resources/views/livewire/project/shared/environment-variable/show.blade.phpindex 0bcb127ba5,86faeeeb4f..9ca92602c9--- a/resources/views/livewire/project/shared/environment-variable/show.blade.php+++ b/resources/views/livewire/project/shared/environment-variable/show.blade.php@@@ -117,44 -151,36 +151,57 @@@@endif</div>@else+ <div class="flex flex-col w-full gap-2">+ <div class="flex flex-col w-full gap-2 lg:flex-row">+ @if ($is_multiline)+ <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 :disabled="$is_redis_credential" :required="$is_redis_credential" id="key" />- <x-forms.input :required="$is_redis_credential" type="password" id="value" />++ <x-forms.env-var-input++ :required="$is_redis_credential"++ type="password"++ id="value"++ :availableVars="$this->availableSharedVariables"++ :projectUuid="data_get($parameters, 'project_uuid')"++ :environmentUuid="data_get($parameters, 'environment_uuid')" />+ @endif+ @if ($is_shared)+ <x-forms.input :disabled="$is_redis_credential" :required="$is_redis_credential" disabled+ type="password" id="real_value" />+ @endif+ </div>- <x-forms.input instantSave id="comment" label="Comment"- helper="Add a note to document what this environment variable is used for." maxlength="256" />++ @if (!$isMagicVariable)++ <x-forms.input instantSave id="comment" label="Comment"++ helper="Add a note to document what this environment variable is used for." maxlength="256" />++ @endif+ </div>+ @endif+ @else+ <div class="flex flex-col w-full gap-2"><div class="flex flex-col w-full gap-2 lg:flex-row">- @if ($is_multiline)- <x-forms.input :required="$is_redis_credential" isMultiline="{{ $is_multiline }}" id="key" />- <x-forms.textarea :required="$is_redis_credential" type="password" id="value" />+ <x-forms.input disabled id="key" />- <x-forms.input disabled type="password" id="value" />- @if ($is_shared)- <x-forms.input disabled type="password" id="real_value" />++ @if ($isValueHidden)++ <div class="w-full">++ <input disabled type="text" value="Hidden (only admins can view)"++ class="input italic !text-neutral-500 dark:!text-neutral-500" />++ </div>+ @else- <x-forms.input :disabled="$is_redis_credential" :required="$is_redis_credential" id="key" />+ <x-forms.env-var-input- :required="$is_redis_credential"++ disabled+ type="password"+ id="value"+ :availableVars="$this->availableSharedVariables"+ :projectUuid="data_get($parameters, 'project_uuid')"+ :environmentUuid="data_get($parameters, 'environment_uuid')" />- @endif- @if ($is_shared)- <x-forms.input :disabled="$is_redis_credential" :required="$is_redis_credential" disabled type="password" id="real_value" />++ @if ($is_shared)++ <x-forms.input disabled type="password" id="real_value" />++ @endif@endif</div>- @endif- @else- <div class="flex flex-col w-full gap-2 lg:flex-row">- <x-forms.input disabled id="key" />- @if ($isValueHidden)- <div class="w-full">- <input disabled type="text" value="Hidden (only admins can view)"- class="input italic !text-neutral-500 dark:!text-neutral-500" />- </div>- @else- <x-forms.env-var-input- disabled- type="password"- id="value"- :availableVars="$this->availableSharedVariables"- :projectUuid="data_get($parameters, 'project_uuid')"- :environmentUuid="data_get($parameters, 'environment_uuid')" />- @if ($is_shared)- <x-forms.input disabled type="password" id="real_value" />- @endif+ @if (!$isMagicVariable)+ <x-forms.input disabled id="comment" label="Comment"+ helper="Add a note to document what this environment variable is used for." maxlength="256" />@endif</div>@endcan