Skip to content

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.

refactor(environment-variables): adjust ordering logic for environment variables

Andras Bacsai4b0f65c92698
diff --git a/app/Models/Application.php b/app/Models/Application.php
index 4f1796790b..914d9948dd 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -739,9 +739,9 @@ class Application extends BaseModel
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
->where('is_preview', false)
->orderByRaw("
- CASE
- WHEN LOWER(key) LIKE 'service_%' THEN 1
- WHEN is_required = true AND (value IS NULL OR value = '') THEN 2
+ CASE
+ WHEN is_required = true THEN 1
+ WHEN LOWER(key) LIKE 'service_%' THEN 2
ELSE 3
END,
LOWER(key) ASC
@@ -767,9 +767,9 @@ class Application extends BaseModel
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
->where('is_preview', true)
->orderByRaw("
- CASE
- WHEN LOWER(key) LIKE 'service_%' THEN 1
- WHEN is_required = true AND (value IS NULL OR value = '') THEN 2
+ CASE
+ WHEN is_required = true THEN 1
+ WHEN LOWER(key) LIKE 'service_%' THEN 2
ELSE 3
END,
LOWER(key) ASC
diff --git a/app/Models/Service.php b/app/Models/Service.php
index c9bf4cbcdb..063c8cba47 100644
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@ -1231,9 +1231,9 @@ class Service extends BaseModel
{
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
->orderByRaw("
- CASE
- WHEN LOWER(key) LIKE 'service_%' THEN 1
- WHEN is_required = true AND (value IS NULL OR value = '') THEN 2
+ CASE
+ WHEN is_required = true THEN 1
+ WHEN LOWER(key) LIKE 'service_%' THEN 2
ELSE 3
END,
LOWER(key) ASC