From 5b3b4bbc43690eb67fe84361c22461b02a1737e2 Mon Sep 17 00:00:00 2001
From: Andras Bacsai <5845193+andrasbacsai@users.noreply.github.com>
Date: Thu, 11 Sep 2025 16:51:56 +0200
Subject: [PATCH] refactor(environment): remove 'is_build_time' attribute from
environment variable handling across the application to simplify
configuration
---
.../Api/ApplicationsController.php | 31 ++-------------
.../Controllers/Api/ServicesController.php | 7 ----
app/Jobs/ApplicationDeploymentJob.php | 23 ++---------
app/Livewire/Project/Application/General.php | 4 --
app/Livewire/Project/New/DockerCompose.php | 1 -
app/Livewire/Project/Resource/Create.php | 1 -
.../Shared/EnvironmentVariable/Add.php | 6 ---
.../Shared/EnvironmentVariable/All.php | 2 -
.../Shared/EnvironmentVariable/Show.php | 8 ----
app/Models/Application.php | 20 +---------
app/Models/EnvironmentVariable.php | 3 --
app/Models/Service.php | 1 -
app/Services/ConfigurationGenerator.php | 2 -
bootstrap/helpers/parsers.php | 22 -----------
bootstrap/helpers/services.php | 4 --
bootstrap/helpers/shared.php | 9 -----
..._time_from_environment_variables_table.php | 38 +++++++++++++++++++
.../shared/environment-variable/add.blade.php | 5 ---
.../environment-variable/show.blade.php | 18 ---------
19 files changed, 47 insertions(+), 158 deletions(-)
create mode 100644 database/migrations/2025_09_11_143432_remove_is_build_time_from_environment_variables_table.php
diff --git a/app/Http/Controllers/Api/ApplicationsController.php b/app/Http/Controllers/Api/ApplicationsController.php
index 7ef1c3506..9b9de640c 100644
--- a/app/Http/Controllers/Api/ApplicationsController.php
+++ b/app/Http/Controllers/Api/ApplicationsController.php
@@ -2429,7 +2429,6 @@ class ApplicationsController extends Controller
'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'],
'value' => ['type' => 'string', 'description' => 'The value of the environment variable.'],
'is_preview' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in preview deployments.'],
- 'is_build_time' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in build time.'],
'is_literal' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is a literal, nothing espaced.'],
'is_multiline' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is multiline.'],
'is_shown_once' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable\'s value is shown on the UI.'],
@@ -2470,7 +2469,7 @@ class ApplicationsController extends Controller
)]
public function update_env_by_uuid(Request $request)
{
- $allowedFields = ['key', 'value', 'is_preview', 'is_build_time', 'is_literal'];
+ $allowedFields = ['key', 'value', 'is_preview', 'is_literal'];
$teamId = getTeamIdFromToken();
if (is_null($teamId)) {
@@ -2495,7 +2494,6 @@ class ApplicationsController extends Controller
'key' => 'string|required',
'value' => 'string|nullable',
'is_preview' => 'boolean',
- 'is_build_time' => 'boolean',
'is_literal' => 'boolean',
'is_multiline' => 'boolean',
'is_shown_once' => 'boolean',
@@ -2516,16 +2514,12 @@ class ApplicationsController extends Controller
], 422);
}
$is_preview = $request->is_preview ?? false;
- $is_build_time = $request->is_build_time ?? false;
$is_literal = $request->is_literal ?? false;
$key = str($request->key)->trim()->replace(' ', '_')->value;
if ($is_preview) {
$env = $application->environment_variables_preview->where('key', $key)->first();
if ($env) {
$env->value = $request->value;
- if ($env->is_build_time != $is_build_time) {
- $env->is_build_time = $is_build_time;
- }
if ($env->is_literal != $is_literal) {
$env->is_literal = $is_literal;
}
@@ -2550,9 +2544,6 @@ class ApplicationsController extends Controller
$env = $application->environment_variables->where('key', $key)->first();
if ($env) {
$env->value = $request->value;
- if ($env->is_build_time != $is_build_time) {
- $env->is_build_time = $is_build_time;
- }
if ($env->is_literal != $is_literal) {
$env->is_literal = $is_literal;
}
@@ -2619,7 +2610,6 @@ class ApplicationsController extends Controller
'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'],
'value' => ['type' => 'string', 'description' => 'The value of the environment variable.'],
'is_preview' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in preview deployments.'],
- 'is_build_time' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in build time.'],
'is_literal' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is a literal, nothing espaced.'],
'is_multiline' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is multiline.'],
'is_shown_once' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable\'s value is shown on the UI.'],
@@ -2690,7 +2680,7 @@ class ApplicationsController extends Controller
], 400);
}
$bulk_data = collect($bulk_data)->map(function ($item) {
- return collect($item)->only(['key', 'value', 'is_preview', 'is_build_time', 'is_literal']);
+ return collect($item)->only(['key', 'value', 'is_preview', 'is_literal']);
});
$returnedEnvs = collect();
foreach ($bulk_data as $item) {
@@ -2698,7 +2688,6 @@ class ApplicationsController extends Controller
'key' => 'string|required',
'value' => 'string|nullable',
'is_preview' => 'boolean',
- 'is_build_time' => 'boolean',
'is_literal' => 'boolean',
'is_multiline' => 'boolean',
'is_shown_once' => 'boolean',
@@ -2710,7 +2699,6 @@ class ApplicationsController extends Controller
], 422);
}
$is_preview = $item->get('is_preview') ?? false;
- $is_build_time = $item->get('is_build_time') ?? false;
$is_literal = $item->get('is_literal') ?? false;
$is_multi_line = $item->get('is_multiline') ?? false;
$is_shown_once = $item->get('is_shown_once') ?? false;
@@ -2719,9 +2707,7 @@ class ApplicationsController extends Controller
$env = $application->environment_variables_preview->where('key', $key)->first();
if ($env) {
$env->value = $item->get('value');
- if ($env->is_build_time != $is_build_time) {
- $env->is_build_time = $is_build_time;
- }
+
if ($env->is_literal != $is_literal) {
$env->is_literal = $is_literal;
}
@@ -2737,7 +2723,6 @@ class ApplicationsController extends Controller
'key' => $item->get('key'),
'value' => $item->get('value'),
'is_preview' => $is_preview,
- 'is_build_time' => $is_build_time,
'is_literal' => $is_literal,
'is_multiline' => $is_multi_line,
'is_shown_once' => $is_shown_once,
@@ -2749,9 +2734,6 @@ class ApplicationsController extends Controller
$env = $application->environment_variables->where('key', $key)->first();
if ($env) {
$env->value = $item->get('value');
- if ($env->is_build_time != $is_build_time) {
- $env->is_build_time = $is_build_time;
- }
if ($env->is_literal != $is_literal) {
$env->is_literal = $is_literal;
}
@@ -2767,7 +2749,6 @@ class ApplicationsController extends Controller
'key' => $item->get('key'),
'value' => $item->get('value'),
'is_preview' => $is_preview,
- 'is_build_time' => $is_build_time,
'is_literal' => $is_literal,
'is_multiline' => $is_multi_line,
'is_shown_once' => $is_shown_once,
@@ -2814,7 +2795,6 @@ class ApplicationsController extends Controller
'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'],
'value' => ['type' => 'string', 'description' => 'The value of the environment variable.'],
'is_preview' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in preview deployments.'],
- 'is_build_time' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in build time.'],
'is_literal' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is a literal, nothing espaced.'],
'is_multiline' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is multiline.'],
'is_shown_once' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable\'s value is shown on the UI.'],
@@ -2854,7 +2834,7 @@ class ApplicationsController extends Controller
)]
public function create_env(Request $request)
{
- $allowedFields = ['key', 'value', 'is_preview', 'is_build_time', 'is_literal'];
+ $allowedFields = ['key', 'value', 'is_preview', 'is_literal'];
$teamId = getTeamIdFromToken();
if (is_null($teamId)) {
@@ -2874,7 +2854,6 @@ class ApplicationsController extends Controller
'key' => 'string|required',
'value' => 'string|nullable',
'is_preview' => 'boolean',
- 'is_build_time' => 'boolean',
'is_literal' => 'boolean',
'is_multiline' => 'boolean',
'is_shown_once' => 'boolean',
@@ -2908,7 +2887,6 @@ class ApplicationsController extends Controller
'key' => $request->key,
'value' => $request->value,
'is_preview' => $request->is_preview ?? false,
- 'is_build_time' => $request->is_build_time ?? false,
'is_literal' => $request->is_literal ?? false,
'is_multiline' => $request->is_multiline ?? false,
'is_shown_once' => $request->is_shown_once ?? false,
@@ -2931,7 +2909,6 @@ class ApplicationsController extends Controller
'key' => $request->key,
'value' => $request->value,
'is_preview' => $request->is_preview ?? false,
- 'is_build_time' => $request->is_build_time ?? false,
'is_literal' => $request->is_literal ?? false,
'is_multiline' => $request->is_multiline ?? false,
'is_shown_once' => $request->is_shown_once ?? false,
diff --git a/app/Http/Controllers/Api/ServicesController.php b/app/Http/Controllers/Api/ServicesController.php
index 162f637c5..e240e326e 100644
--- a/app/Http/Controllers/Api/ServicesController.php
+++ b/app/Http/Controllers/Api/ServicesController.php
@@ -353,7 +353,6 @@ class ServicesController extends Controller
'value' => $generatedValue,
'resourceable_id' => $service->id,
'resourceable_type' => $service->getMorphClass(),
- 'is_build_time' => false,
'is_preview' => false,
]);
});
@@ -919,7 +918,6 @@ class ServicesController extends Controller
'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'],
'value' => ['type' => 'string', 'description' => 'The value of the environment variable.'],
'is_preview' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in preview deployments.'],
- 'is_build_time' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in build time.'],
'is_literal' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is a literal, nothing espaced.'],
'is_multiline' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is multiline.'],
'is_shown_once' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable\'s value is shown on the UI.'],
@@ -975,7 +973,6 @@ class ServicesController extends Controller
$validator = customApiValidator($request->all(), [
'key' => 'string|required',
'value' => 'string|nullable',
- 'is_build_time' => 'boolean',
'is_literal' => 'boolean',
'is_multiline' => 'boolean',
'is_shown_once' => 'boolean',
@@ -1039,7 +1036,6 @@ class ServicesController extends Controller
'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'],
'value' => ['type' => 'string', 'description' => 'The value of the environment variable.'],
'is_preview' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in preview deployments.'],
- 'is_build_time' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in build time.'],
'is_literal' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is a literal, nothing espaced.'],
'is_multiline' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is multiline.'],
'is_shown_once' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable\'s value is shown on the UI.'],
@@ -1105,7 +1101,6 @@ class ServicesController extends Controller
$validator = customApiValidator($item, [
'key' => 'string|required',
'value' => 'string|nullable',
- 'is_build_time' => 'boolean',
'is_literal' => 'boolean',
'is_multiline' => 'boolean',
'is_shown_once' => 'boolean',
@@ -1161,7 +1156,6 @@ class ServicesController extends Controller
'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'],
'value' => ['type' => 'string', 'description' => 'The value of the environment variable.'],
'is_preview' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in preview deployments.'],
- 'is_build_time' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is used in build time.'],
'is_literal' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is a literal, nothing espaced.'],
'is_multiline' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable is multiline.'],
'is_shown_once' => ['type' => 'boolean', 'description' => 'The flag to indicate if the environment variable\'s value is shown on the UI.'],
@@ -1216,7 +1210,6 @@ class ServicesController extends Controller
$validator = customApiValidator($request->all(), [
'key' => 'string|required',
'value' => 'string|nullable',
- 'is_build_time' => 'boolean',
'is_literal' => 'boolean',
'is_multiline' => 'boolean',
'is_shown_once' => 'boolean',
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index a3a7f00a6..8807f0f97 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -1049,32 +1049,17 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$envType = 'environment_variables_preview';
}
$mix_env = $this->application->{$envType}->where('key', 'MIX_ENV')->first();
- if ($mix_env) {
- if ($mix_env->is_build_time === false) {
- $this->application_deployment_queue->addLogEntry('MIX_ENV environment variable is not set as build time.', type: 'error');
- $this->application_deployment_queue->addLogEntry('Please set MIX_ENV environment variable to be build time variable if you facing any issues with the deployment.', type: 'error');
- }
- } else {
+ if (! $mix_env) {
$this->application_deployment_queue->addLogEntry('MIX_ENV environment variable not found.', type: 'error');
$this->application_deployment_queue->addLogEntry('Please add MIX_ENV environment variable and set it to be build time variable if you facing any issues with the deployment.', type: 'error');
}
$secret_key_base = $this->application->{$envType}->where('key', 'SECRET_KEY_BASE')->first();
- if ($secret_key_base) {
- if ($secret_key_base->is_build_time === false) {
- $this->application_deployment_queue->addLogEntry('SECRET_KEY_BASE environment variable is not set as build time.', type: 'error');
- $this->application_deployment_queue->addLogEntry('Please set SECRET_KEY_BASE environment variable to be build time variable if you facing any issues with the deployment.', type: 'error');
- }
- } else {
+ if (! $secret_key_base) {
$this->application_deployment_queue->addLogEntry('SECRET_KEY_BASE environment variable not found.', type: 'error');
$this->application_deployment_queue->addLogEntry('Please add SECRET_KEY_BASE environment variable and set it to be build time variable if you facing any issues with the deployment.', type: 'error');
}
$database_url = $this->application->{$envType}->where('key', 'DATABASE_URL')->first();
- if ($database_url) {
- if ($database_url->is_build_time === false) {
- $this->application_deployment_queue->addLogEntry('DATABASE_URL environment variable is not set as build time.', type: 'error');
- $this->application_deployment_queue->addLogEntry('Please set DATABASE_URL environment variable to be build time variable if you facing any issues with the deployment.', type: 'error');
- }
- } else {
+ if (! $database_url) {
$this->application_deployment_queue->addLogEntry('DATABASE_URL environment variable not found.', type: 'error');
$this->application_deployment_queue->addLogEntry('Please add DATABASE_URL environment variable and set it to be build time variable if you facing any issues with the deployment.', type: 'error');
}
@@ -1094,7 +1079,6 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$nixpacks_php_fallback_path = new EnvironmentVariable;
$nixpacks_php_fallback_path->key = 'NIXPACKS_PHP_FALLBACK_PATH';
$nixpacks_php_fallback_path->value = '/index.php';
- $nixpacks_php_fallback_path->is_build_time = false;
$nixpacks_php_fallback_path->resourceable_id = $this->application->id;
$nixpacks_php_fallback_path->resourceable_type = 'App\Models\Application';
$nixpacks_php_fallback_path->save();
@@ -1103,7 +1087,6 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$nixpacks_php_root_dir = new EnvironmentVariable;
$nixpacks_php_root_dir->key = 'NIXPACKS_PHP_ROOT_DIR';
$nixpacks_php_root_dir->value = '/app/public';
- $nixpacks_php_root_dir->is_build_time = false;
$nixpacks_php_root_dir->resourceable_id = $this->application->id;
$nixpacks_php_root_dir->resourceable_type = 'App\Models\Application';
$nixpacks_php_root_dir->save();
diff --git a/app/Livewire/Project/Application/General.php b/app/Livewire/Project/Application/General.php
index 9f15011c2..c77d050cb 100644
--- a/app/Livewire/Project/Application/General.php
+++ b/app/Livewire/Project/Application/General.php
@@ -703,7 +703,6 @@ class General extends Component
'key' => "SERVICE_FQDN_{$serviceNameFormatted}",
], [
'value' => $fqdnValue,
- 'is_build_time' => false,
'is_preview' => false,
]);
@@ -712,7 +711,6 @@ class General extends Component
'key' => "SERVICE_URL_{$serviceNameFormatted}",
], [
'value' => $urlValue,
- 'is_build_time' => false,
'is_preview' => false,
]);
// Create/update port-specific variables if port exists
@@ -721,7 +719,6 @@ class General extends Component
'key' => "SERVICE_FQDN_{$serviceNameFormatted}_{$port}",
], [
'value' => $fqdnValue,
- 'is_build_time' => false,
'is_preview' => false,
]);
@@ -729,7 +726,6 @@ class General extends Component
'key' => "SERVICE_URL_{$serviceNameFormatted}_{$port}",
], [
'value' => $urlValue,
- 'is_build_time' => false,
'is_preview' => false,
]);
}
diff --git a/app/Livewire/Project/New/DockerCompose.php b/app/Livewire/Project/New/DockerCompose.php
index 7c81e810c..5cda1dedd 100644
--- a/app/Livewire/Project/New/DockerCompose.php
+++ b/app/Livewire/Project/New/DockerCompose.php
@@ -63,7 +63,6 @@ class DockerCompose extends Component
EnvironmentVariable::create([
'key' => $key,
'value' => $variable,
- 'is_build_time' => false,
'is_preview' => false,
'resourceable_id' => $service->id,
'resourceable_type' => $service->getMorphClass(),
diff --git a/app/Livewire/Project/Resource/Create.php b/app/Livewire/Project/Resource/Create.php
index 3dbe4230c..73960d288 100644
--- a/app/Livewire/Project/Resource/Create.php
+++ b/app/Livewire/Project/Resource/Create.php
@@ -97,7 +97,6 @@ class Create extends Component
'value' => $value,
'resourceable_id' => $service->id,
'resourceable_type' => $service->getMorphClass(),
- 'is_build_time' => false,
'is_preview' => false,
]);
}
diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/Add.php b/app/Livewire/Project/Shared/EnvironmentVariable/Add.php
index cf7843f84..a2d783232 100644
--- a/app/Livewire/Project/Shared/EnvironmentVariable/Add.php
+++ b/app/Livewire/Project/Shared/EnvironmentVariable/Add.php
@@ -19,8 +19,6 @@ class Add extends Component
public ?string $value = null;
- public bool $is_build_time = false;
-
public bool $is_multiline = false;
public bool $is_literal = false;
@@ -30,7 +28,6 @@ class Add extends Component
protected $rules = [
'key' => 'required|string',
'value' => 'nullable',
- 'is_build_time' => 'required|boolean',
'is_multiline' => 'required|boolean',
'is_literal' => 'required|boolean',
];
@@ -38,7 +35,6 @@ class Add extends Component
protected $validationAttributes = [
'key' => 'key',
'value' => 'value',
- 'is_build_time' => 'build',
'is_multiline' => 'multiline',
'is_literal' => 'literal',
];
@@ -54,7 +50,6 @@ class Add extends Component
$this->dispatch('saveKey', [
'key' => $this->key,
'value' => $this->value,
- 'is_build_time' => $this->is_build_time,
'is_multiline' => $this->is_multiline,
'is_literal' => $this->is_literal,
'is_preview' => $this->is_preview,
@@ -66,7 +61,6 @@ class Add extends Component
{
$this->key = '';
$this->value = '';
- $this->is_build_time = false;
$this->is_multiline = false;
$this->is_literal = false;
}
diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/All.php b/app/Livewire/Project/Shared/EnvironmentVariable/All.php
index 141263ba2..884441ec2 100644
--- a/app/Livewire/Project/Shared/EnvironmentVariable/All.php
+++ b/app/Livewire/Project/Shared/EnvironmentVariable/All.php
@@ -212,7 +212,6 @@ class All extends Component
$environment = new EnvironmentVariable;
$environment->key = $data['key'];
$environment->value = $data['value'];
- $environment->is_build_time = $data['is_build_time'] ?? false;
$environment->is_multiline = $data['is_multiline'] ?? false;
$environment->is_literal = $data['is_literal'] ?? false;
$environment->is_preview = $data['is_preview'] ?? false;
@@ -276,7 +275,6 @@ class All extends Component
$environment = new EnvironmentVariable;
$environment->key = $key;
$environment->value = $value;
- $environment->is_build_time = false;
$environment->is_multiline = false;
$environment->is_preview = $isPreview;
$environment->resourceable_id = $this->resource->id;
diff --git a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php b/app/Livewire/Project/Shared/EnvironmentVariable/Show.php
index f8b06bff8..14b532bf8 100644
--- a/app/Livewire/Project/Shared/EnvironmentVariable/Show.php
+++ b/app/Livewire/Project/Shared/EnvironmentVariable/Show.php
@@ -32,8 +32,6 @@ class Show extends Component
public bool $is_shared = false;
- public bool $is_build_time = false;
-
public bool $is_multiline = false;
public bool $is_literal = false;
@@ -55,7 +53,6 @@ class Show extends Component
protected $rules = [
'key' => 'required|string',
'value' => 'nullable',
- 'is_build_time' => 'required|boolean',
'is_multiline' => 'required|boolean',
'is_literal' => 'required|boolean',
'is_shown_once' => 'required|boolean',
@@ -101,7 +98,6 @@ class Show extends Component
]);
} else {
$this->validate();
- $this->env->is_build_time = $this->is_build_time;
$this->env->is_required = $this->is_required;
$this->env->is_shared = $this->is_shared;
}
@@ -114,7 +110,6 @@ class Show extends Component
} else {
$this->key = $this->env->key;
$this->value = $this->env->value;
- $this->is_build_time = $this->env->is_build_time ?? false;
$this->is_multiline = $this->env->is_multiline;
$this->is_literal = $this->env->is_literal;
$this->is_shown_once = $this->env->is_shown_once;
@@ -139,9 +134,6 @@ class Show extends Component
public function serialize()
{
data_forget($this->env, 'real_value');
- if ($this->env->getMorphClass() === \App\Models\SharedEnvironmentVariable::class) {
- data_forget($this->env, 'is_build_time');
- }
}
public function lock()
diff --git a/app/Models/Application.php b/app/Models/Application.php
index 4a22a1953..30be56523 100644
--- a/app/Models/Application.php
+++ b/app/Models/Application.php
@@ -738,14 +738,6 @@ class Application extends BaseModel
->where('key', 'not like', 'NIXPACKS_%');
}
- public function build_environment_variables()
- {
- return $this->morphMany(EnvironmentVariable::class, 'resourceable')
- ->where('is_preview', false)
- ->where('is_build_time', true)
- ->where('key', 'not like', 'NIXPACKS_%');
- }
-
public function nixpacks_environment_variables()
{
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
@@ -767,14 +759,6 @@ class Application extends BaseModel
->where('key', 'not like', 'NIXPACKS_%');
}
- public function build_environment_variables_preview()
- {
- return $this->morphMany(EnvironmentVariable::class, 'resourceable')
- ->where('is_preview', true)
- ->where('is_build_time', true)
- ->where('key', 'not like', 'NIXPACKS_%');
- }
-
public function nixpacks_environment_variables_preview()
{
return $this->morphMany(EnvironmentVariable::class, 'resourceable')
@@ -936,9 +920,9 @@ class Application extends BaseModel
{
$newConfigHash = base64_encode($this->fqdn.$this->git_repository.$this->git_branch.$this->git_commit_sha.$this->build_pack.$this->static_image.$this->install_command.$this->build_command.$this->start_command.$this->ports_exposes.$this->ports_mappings.$this->base_directory.$this->publish_directory.$this->dockerfile.$this->dockerfile_location.$this->custom_labels.$this->custom_docker_run_options.$this->dockerfile_target_build.$this->redirect.$this->custom_nginx_configuration.$this->custom_labels);
if ($this->pull_request_id === 0 || $this->pull_request_id === null) {
- $newConfigHash .= json_encode($this->environment_variables()->get(['value', 'is_build_time', 'is_multiline', 'is_literal'])->sort());
+ $newConfigHash .= json_encode($this->environment_variables()->get(['value', 'is_multiline', 'is_literal'])->sort());
} else {
- $newConfigHash .= json_encode($this->environment_variables_preview->get(['value', 'is_build_time', 'is_multiline', 'is_literal'])->sort());
+ $newConfigHash .= json_encode($this->environment_variables_preview->get(['value', 'is_multiline', 'is_literal'])->sort());
}
$newConfigHash = md5($newConfigHash);
$oldConfigHash = data_get($this, 'config_hash');
diff --git a/app/Models/EnvironmentVariable.php b/app/Models/EnvironmentVariable.php
index f99930543..0afa703c2 100644
--- a/app/Models/EnvironmentVariable.php
+++ b/app/Models/EnvironmentVariable.php
@@ -14,7 +14,6 @@ use OpenApi\Attributes as OA;
'uuid' => ['type' => 'string'],
'resourceable_type' => ['type' => 'string'],
'resourceable_id' => ['type' => 'integer'],
- 'is_build_time' => ['type' => 'boolean'],
'is_literal' => ['type' => 'boolean'],
'is_multiline' => ['type' => 'boolean'],
'is_preview' => ['type' => 'boolean'],
@@ -35,7 +34,6 @@ class EnvironmentVariable extends BaseModel
protected $casts = [
'key' => 'string',
'value' => 'encrypted',
- 'is_build_time' => 'boolean',
'is_multiline' => 'boolean',
'is_preview' => 'boolean',
'version' => 'string',
@@ -61,7 +59,6 @@ class EnvironmentVariable extends BaseModel
ModelsEnvironmentVariable::create([
'key' => $environment_variable->key,
'value' => $environment_variable->value,
- 'is_build_time' => $environment_variable->is_build_time,
'is_multiline' => $environment_variable->is_multiline ?? false,
'is_literal' => $environment_variable->is_literal ?? false,
'resourceable_type' => Application::class,
diff --git a/app/Models/Service.php b/app/Models/Service.php
index bd185b355..108575d56 100644
--- a/app/Models/Service.php
+++ b/app/Models/Service.php
@@ -1113,7 +1113,6 @@ class Service extends BaseModel
$this->environment_variables()->create([
'key' => $key,
'value' => $value,
- 'is_build_time' => false,
'resourceable_id' => $this->id,
'resourceable_type' => $this->getMorphClass(),
'is_preview' => false,
diff --git a/app/Services/ConfigurationGenerator.php b/app/Services/ConfigurationGenerator.php
index a7e4b31be..320e3f32a 100644
--- a/app/Services/ConfigurationGenerator.php
+++ b/app/Services/ConfigurationGenerator.php
@@ -129,7 +129,6 @@ class ConfigurationGenerator
$variables->push([
'key' => $env->key,
'value' => $env->value,
- 'is_build_time' => $env->is_build_time,
'is_preview' => $env->is_preview,
'is_multiline' => $env->is_multiline,
]);
@@ -145,7 +144,6 @@ class ConfigurationGenerator
$variables->push([
'key' => $env->key,
'value' => $env->value,
- 'is_build_time' => $env->is_build_time,
'is_preview' => $env->is_preview,
'is_multiline' => $env->is_multiline,
]);
diff --git a/bootstrap/helpers/parsers.php b/bootstrap/helpers/parsers.php
index 3dbfb6b33..d4701d251 100644
--- a/bootstrap/helpers/parsers.php
+++ b/bootstrap/helpers/parsers.php
@@ -342,7 +342,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id,
], [
'value' => $fqdn,
- 'is_build_time' => false,
'is_preview' => false,
]);
}
@@ -355,7 +354,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id,
], [
'value' => $fqdn,
- 'is_build_time' => false,
'is_preview' => false,
]);
}
@@ -384,7 +382,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id,
], [
'value' => $fqdn,
- 'is_build_time' => false,
'is_preview' => false,
]);
if ($resource->build_pack === 'dockercompose') {
@@ -418,7 +415,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id,
], [
'value' => $url,
- 'is_build_time' => false,
'is_preview' => false,
]);
if ($resource->build_pack === 'dockercompose') {
@@ -446,7 +442,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id,
], [
'value' => $value,
- 'is_build_time' => false,
'is_preview' => false,
]);
}
@@ -760,7 +755,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id,
], [
'value' => $value,
- 'is_build_time' => false,
'is_preview' => false,
]);
@@ -777,7 +771,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id,
], [
'value' => $value,
- 'is_build_time' => false,
'is_preview' => false,
]);
} else {
@@ -813,7 +806,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id,
], [
- 'is_build_time' => false,
'is_preview' => false,
'is_required' => $isRequired,
]);
@@ -828,7 +820,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id,
], [
'value' => $value,
- 'is_build_time' => false,
'is_preview' => false,
'is_required' => $isRequired,
]);
@@ -886,7 +877,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'key' => 'SERVICE_URL_'.str($forServiceName)->upper()->replace('-', '_')->replace('.', '_'),
], [
'value' => $coolifyUrl->__toString(),
- 'is_build_time' => false,
'is_preview' => false,
]);
$resource->environment_variables()->updateOrCreate([
@@ -895,7 +885,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'key' => 'SERVICE_FQDN_'.str($forServiceName)->upper()->replace('-', '_')->replace('.', '_'),
], [
'value' => $coolifyFqdn,
- 'is_build_time' => false,
'is_preview' => false,
]);
} else {
@@ -1343,7 +1332,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id,
], [
'value' => $fqdn,
- 'is_build_time' => false,
'is_preview' => false,
]);
$resource->environment_variables()->updateOrCreate([
@@ -1352,7 +1340,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id,
], [
'value' => $url,
- 'is_build_time' => false,
'is_preview' => false,
]);
}
@@ -1364,7 +1351,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id,
], [
'value' => $fqdn,
- 'is_build_time' => false,
'is_preview' => false,
]);
$resource->environment_variables()->updateOrCreate([
@@ -1373,7 +1359,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id,
], [
'value' => $url,
- 'is_build_time' => false,
'is_preview' => false,
]);
}
@@ -1403,7 +1388,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id,
], [
'value' => $fqdn,
- 'is_build_time' => false,
'is_preview' => false,
]);
@@ -1423,7 +1407,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id,
], [
'value' => $url,
- 'is_build_time' => false,
'is_preview' => false,
]);
@@ -1435,7 +1418,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id,
], [
'value' => $value,
- 'is_build_time' => false,
'is_preview' => false,
]);
}
@@ -1754,7 +1736,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id,
], [
'value' => $value,
- 'is_build_time' => false,
'is_preview' => false,
]);
@@ -1771,7 +1752,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id,
], [
'value' => $value,
- 'is_build_time' => false,
'is_preview' => false,
]);
} else {
@@ -1807,7 +1787,6 @@ function serviceParser(Service $resource): Collection
'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id,
], [
- 'is_build_time' => false,
'is_preview' => false,
'is_required' => $isRequired,
]);
@@ -1822,7 +1801,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id,
], [
'value' => $value,
- 'is_build_time' => false,
'is_preview' => false,
'is_required' => $isRequired,
]);
diff --git a/bootstrap/helpers/services.php b/bootstrap/helpers/services.php
index 7d3cb71ff..41b8857ee 100644
--- a/bootstrap/helpers/services.php
+++ b/bootstrap/helpers/services.php
@@ -133,7 +133,6 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource)
'key' => $variableName,
], [
'value' => $urlValue,
- 'is_build_time' => false,
'is_preview' => false,
]);
if ($port) {
@@ -144,7 +143,6 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource)
'key' => $variableName,
], [
'value' => $urlValue,
- 'is_build_time' => false,
'is_preview' => false,
]);
}
@@ -163,7 +161,6 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource)
'key' => $variableName,
], [
'value' => $fqdnValue,
- 'is_build_time' => false,
'is_preview' => false,
]);
if ($port) {
@@ -174,7 +171,6 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource)
'key' => $variableName,
], [
'value' => $fqdnValue,
- 'is_build_time' => false,
'is_preview' => false,
]);
}
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index 6778a0ed1..28f5a083d 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -1564,7 +1564,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
EnvironmentVariable::create([
'key' => $key,
'value' => $fqdn,
- 'is_build_time' => false,
'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id,
'is_preview' => false,
@@ -1644,7 +1643,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
EnvironmentVariable::create([
'key' => $key,
'value' => $fqdn,
- 'is_build_time' => false,
'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id,
'is_preview' => false,
@@ -1683,7 +1681,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
EnvironmentVariable::create([
'key' => $key,
'value' => $generatedValue,
- 'is_build_time' => false,
'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id,
'is_preview' => false,
@@ -1722,7 +1719,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
'resourceable_id' => $resource->id,
], [
'value' => $defaultValue,
- 'is_build_time' => false,
'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id,
'is_preview' => false,
@@ -2413,7 +2409,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
EnvironmentVariable::create([
'key' => $key,
'value' => $fqdn,
- 'is_build_time' => false,
'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id,
'is_preview' => false,
@@ -2425,7 +2420,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
EnvironmentVariable::create([
'key' => $key,
'value' => $generatedValue,
- 'is_build_time' => false,
'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id,
'is_preview' => false,
@@ -2459,20 +2453,17 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
if ($foundEnv) {
$defaultValue = data_get($foundEnv, 'value');
}
- $isBuildTime = data_get($foundEnv, 'is_build_time', false);
if ($foundEnv) {
$foundEnv->update([
'key' => $key,
'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id,
- 'is_build_time' => $isBuildTime,
'value' => $defaultValue,
]);
} else {
EnvironmentVariable::create([
'key' => $key,
'value' => $defaultValue,
- 'is_build_time' => $isBuildTime,
'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id,
'is_preview' => false,
diff --git a/database/migrations/2025_09_11_143432_remove_is_build_time_from_environment_variables_table.php b/database/migrations/2025_09_11_143432_remove_is_build_time_from_environment_variables_table.php
new file mode 100644
index 000000000..076ee8e09
--- /dev/null
+++ b/database/migrations/2025_09_11_143432_remove_is_build_time_from_environment_variables_table.php
@@ -0,0 +1,38 @@
+dropColumn('is_build_time');
+ }
+ });
+ }
+
+ /**
+ * Reverse the migrations.
+ */
+ public function down(): void
+ {
+ Schema::table('environment_variables', function (Blueprint $table) {
+ // Re-add the is_build_time column
+ if (! Schema::hasColumn('environment_variables', 'is_build_time')) {
+ $table->boolean('is_build_time')->default(false)->after('value');
+ }
+ });
+ }
+};
diff --git a/resources/views/livewire/project/shared/environment-variable/add.blade.php b/resources/views/livewire/project/shared/environment-variable/add.blade.php
index 6dd75aa9a..8e0993d43 100644
--- a/resources/views/livewire/project/shared/environment-variable/add.blade.php
+++ b/resources/views/livewire/project/shared/environment-variable/add.blade.php
@@ -3,11 +3,6 @@
- @if (data_get($parameters, 'application_uuid'))
-
- @endif
@if (!$shared)
@if (!$is_redis_credential)
@if ($type === 'service')
-
@else
@if ($is_shared)
-
@@ -77,9 +71,6 @@
@if ($isSharedVariable)
@else
-
@if ($is_multiline === false)
@if (!$is_redis_credential)
@if ($type === 'service')
-
@else
@if ($is_shared)
-
@@ -142,9 +127,6 @@
@if ($isSharedVariable)
@else
-
@if ($is_multiline === false)