refactor(environment): remove 'is_build_time' attribute from environment variable handling across the application to simplify configuration

This commit is contained in:
Andras Bacsai
2025-09-11 16:51:56 +02:00
parent 1d0719238c
commit 5b3b4bbc43
19 changed files with 47 additions and 158 deletions

View File

@@ -2429,7 +2429,6 @@ class ApplicationsController extends Controller
'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'], 'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'],
'value' => ['type' => 'string', 'description' => 'The value 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_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_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_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.'], '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) 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(); $teamId = getTeamIdFromToken();
if (is_null($teamId)) { if (is_null($teamId)) {
@@ -2495,7 +2494,6 @@ class ApplicationsController extends Controller
'key' => 'string|required', 'key' => 'string|required',
'value' => 'string|nullable', 'value' => 'string|nullable',
'is_preview' => 'boolean', 'is_preview' => 'boolean',
'is_build_time' => 'boolean',
'is_literal' => 'boolean', 'is_literal' => 'boolean',
'is_multiline' => 'boolean', 'is_multiline' => 'boolean',
'is_shown_once' => 'boolean', 'is_shown_once' => 'boolean',
@@ -2516,16 +2514,12 @@ class ApplicationsController extends Controller
], 422); ], 422);
} }
$is_preview = $request->is_preview ?? false; $is_preview = $request->is_preview ?? false;
$is_build_time = $request->is_build_time ?? false;
$is_literal = $request->is_literal ?? false; $is_literal = $request->is_literal ?? false;
$key = str($request->key)->trim()->replace(' ', '_')->value; $key = str($request->key)->trim()->replace(' ', '_')->value;
if ($is_preview) { if ($is_preview) {
$env = $application->environment_variables_preview->where('key', $key)->first(); $env = $application->environment_variables_preview->where('key', $key)->first();
if ($env) { if ($env) {
$env->value = $request->value; $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) { if ($env->is_literal != $is_literal) {
$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(); $env = $application->environment_variables->where('key', $key)->first();
if ($env) { if ($env) {
$env->value = $request->value; $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) { if ($env->is_literal != $is_literal) {
$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.'], 'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'],
'value' => ['type' => 'string', 'description' => 'The value 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_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_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_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.'], '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); ], 400);
} }
$bulk_data = collect($bulk_data)->map(function ($item) { $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(); $returnedEnvs = collect();
foreach ($bulk_data as $item) { foreach ($bulk_data as $item) {
@@ -2698,7 +2688,6 @@ class ApplicationsController extends Controller
'key' => 'string|required', 'key' => 'string|required',
'value' => 'string|nullable', 'value' => 'string|nullable',
'is_preview' => 'boolean', 'is_preview' => 'boolean',
'is_build_time' => 'boolean',
'is_literal' => 'boolean', 'is_literal' => 'boolean',
'is_multiline' => 'boolean', 'is_multiline' => 'boolean',
'is_shown_once' => 'boolean', 'is_shown_once' => 'boolean',
@@ -2710,7 +2699,6 @@ class ApplicationsController extends Controller
], 422); ], 422);
} }
$is_preview = $item->get('is_preview') ?? false; $is_preview = $item->get('is_preview') ?? false;
$is_build_time = $item->get('is_build_time') ?? false;
$is_literal = $item->get('is_literal') ?? false; $is_literal = $item->get('is_literal') ?? false;
$is_multi_line = $item->get('is_multiline') ?? false; $is_multi_line = $item->get('is_multiline') ?? false;
$is_shown_once = $item->get('is_shown_once') ?? 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(); $env = $application->environment_variables_preview->where('key', $key)->first();
if ($env) { if ($env) {
$env->value = $item->get('value'); $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) { if ($env->is_literal != $is_literal) {
$env->is_literal = $is_literal; $env->is_literal = $is_literal;
} }
@@ -2737,7 +2723,6 @@ class ApplicationsController extends Controller
'key' => $item->get('key'), 'key' => $item->get('key'),
'value' => $item->get('value'), 'value' => $item->get('value'),
'is_preview' => $is_preview, 'is_preview' => $is_preview,
'is_build_time' => $is_build_time,
'is_literal' => $is_literal, 'is_literal' => $is_literal,
'is_multiline' => $is_multi_line, 'is_multiline' => $is_multi_line,
'is_shown_once' => $is_shown_once, 'is_shown_once' => $is_shown_once,
@@ -2749,9 +2734,6 @@ class ApplicationsController extends Controller
$env = $application->environment_variables->where('key', $key)->first(); $env = $application->environment_variables->where('key', $key)->first();
if ($env) { if ($env) {
$env->value = $item->get('value'); $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) { if ($env->is_literal != $is_literal) {
$env->is_literal = $is_literal; $env->is_literal = $is_literal;
} }
@@ -2767,7 +2749,6 @@ class ApplicationsController extends Controller
'key' => $item->get('key'), 'key' => $item->get('key'),
'value' => $item->get('value'), 'value' => $item->get('value'),
'is_preview' => $is_preview, 'is_preview' => $is_preview,
'is_build_time' => $is_build_time,
'is_literal' => $is_literal, 'is_literal' => $is_literal,
'is_multiline' => $is_multi_line, 'is_multiline' => $is_multi_line,
'is_shown_once' => $is_shown_once, 'is_shown_once' => $is_shown_once,
@@ -2814,7 +2795,6 @@ class ApplicationsController extends Controller
'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'], 'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'],
'value' => ['type' => 'string', 'description' => 'The value 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_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_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_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.'], '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) 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(); $teamId = getTeamIdFromToken();
if (is_null($teamId)) { if (is_null($teamId)) {
@@ -2874,7 +2854,6 @@ class ApplicationsController extends Controller
'key' => 'string|required', 'key' => 'string|required',
'value' => 'string|nullable', 'value' => 'string|nullable',
'is_preview' => 'boolean', 'is_preview' => 'boolean',
'is_build_time' => 'boolean',
'is_literal' => 'boolean', 'is_literal' => 'boolean',
'is_multiline' => 'boolean', 'is_multiline' => 'boolean',
'is_shown_once' => 'boolean', 'is_shown_once' => 'boolean',
@@ -2908,7 +2887,6 @@ class ApplicationsController extends Controller
'key' => $request->key, 'key' => $request->key,
'value' => $request->value, 'value' => $request->value,
'is_preview' => $request->is_preview ?? false, 'is_preview' => $request->is_preview ?? false,
'is_build_time' => $request->is_build_time ?? false,
'is_literal' => $request->is_literal ?? false, 'is_literal' => $request->is_literal ?? false,
'is_multiline' => $request->is_multiline ?? false, 'is_multiline' => $request->is_multiline ?? false,
'is_shown_once' => $request->is_shown_once ?? false, 'is_shown_once' => $request->is_shown_once ?? false,
@@ -2931,7 +2909,6 @@ class ApplicationsController extends Controller
'key' => $request->key, 'key' => $request->key,
'value' => $request->value, 'value' => $request->value,
'is_preview' => $request->is_preview ?? false, 'is_preview' => $request->is_preview ?? false,
'is_build_time' => $request->is_build_time ?? false,
'is_literal' => $request->is_literal ?? false, 'is_literal' => $request->is_literal ?? false,
'is_multiline' => $request->is_multiline ?? false, 'is_multiline' => $request->is_multiline ?? false,
'is_shown_once' => $request->is_shown_once ?? false, 'is_shown_once' => $request->is_shown_once ?? false,

View File

@@ -353,7 +353,6 @@ class ServicesController extends Controller
'value' => $generatedValue, 'value' => $generatedValue,
'resourceable_id' => $service->id, 'resourceable_id' => $service->id,
'resourceable_type' => $service->getMorphClass(), 'resourceable_type' => $service->getMorphClass(),
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
}); });
@@ -919,7 +918,6 @@ class ServicesController extends Controller
'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'], 'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'],
'value' => ['type' => 'string', 'description' => 'The value 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_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_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_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.'], '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(), [ $validator = customApiValidator($request->all(), [
'key' => 'string|required', 'key' => 'string|required',
'value' => 'string|nullable', 'value' => 'string|nullable',
'is_build_time' => 'boolean',
'is_literal' => 'boolean', 'is_literal' => 'boolean',
'is_multiline' => 'boolean', 'is_multiline' => 'boolean',
'is_shown_once' => 'boolean', 'is_shown_once' => 'boolean',
@@ -1039,7 +1036,6 @@ class ServicesController extends Controller
'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'], 'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'],
'value' => ['type' => 'string', 'description' => 'The value 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_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_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_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.'], '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, [ $validator = customApiValidator($item, [
'key' => 'string|required', 'key' => 'string|required',
'value' => 'string|nullable', 'value' => 'string|nullable',
'is_build_time' => 'boolean',
'is_literal' => 'boolean', 'is_literal' => 'boolean',
'is_multiline' => 'boolean', 'is_multiline' => 'boolean',
'is_shown_once' => 'boolean', 'is_shown_once' => 'boolean',
@@ -1161,7 +1156,6 @@ class ServicesController extends Controller
'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'], 'key' => ['type' => 'string', 'description' => 'The key of the environment variable.'],
'value' => ['type' => 'string', 'description' => 'The value 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_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_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_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.'], '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(), [ $validator = customApiValidator($request->all(), [
'key' => 'string|required', 'key' => 'string|required',
'value' => 'string|nullable', 'value' => 'string|nullable',
'is_build_time' => 'boolean',
'is_literal' => 'boolean', 'is_literal' => 'boolean',
'is_multiline' => 'boolean', 'is_multiline' => 'boolean',
'is_shown_once' => 'boolean', 'is_shown_once' => 'boolean',

View File

@@ -1049,32 +1049,17 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$envType = 'environment_variables_preview'; $envType = 'environment_variables_preview';
} }
$mix_env = $this->application->{$envType}->where('key', 'MIX_ENV')->first(); $mix_env = $this->application->{$envType}->where('key', 'MIX_ENV')->first();
if ($mix_env) { 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 {
$this->application_deployment_queue->addLogEntry('MIX_ENV environment variable not found.', type: 'error'); $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'); $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(); $secret_key_base = $this->application->{$envType}->where('key', 'SECRET_KEY_BASE')->first();
if ($secret_key_base) { 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 {
$this->application_deployment_queue->addLogEntry('SECRET_KEY_BASE environment variable not found.', type: 'error'); $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'); $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(); $database_url = $this->application->{$envType}->where('key', 'DATABASE_URL')->first();
if ($database_url) { 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 {
$this->application_deployment_queue->addLogEntry('DATABASE_URL environment variable not found.', type: 'error'); $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'); $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 = new EnvironmentVariable;
$nixpacks_php_fallback_path->key = 'NIXPACKS_PHP_FALLBACK_PATH'; $nixpacks_php_fallback_path->key = 'NIXPACKS_PHP_FALLBACK_PATH';
$nixpacks_php_fallback_path->value = '/index.php'; $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_id = $this->application->id;
$nixpacks_php_fallback_path->resourceable_type = 'App\Models\Application'; $nixpacks_php_fallback_path->resourceable_type = 'App\Models\Application';
$nixpacks_php_fallback_path->save(); $nixpacks_php_fallback_path->save();
@@ -1103,7 +1087,6 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$nixpacks_php_root_dir = new EnvironmentVariable; $nixpacks_php_root_dir = new EnvironmentVariable;
$nixpacks_php_root_dir->key = 'NIXPACKS_PHP_ROOT_DIR'; $nixpacks_php_root_dir->key = 'NIXPACKS_PHP_ROOT_DIR';
$nixpacks_php_root_dir->value = '/app/public'; $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_id = $this->application->id;
$nixpacks_php_root_dir->resourceable_type = 'App\Models\Application'; $nixpacks_php_root_dir->resourceable_type = 'App\Models\Application';
$nixpacks_php_root_dir->save(); $nixpacks_php_root_dir->save();

View File

@@ -703,7 +703,6 @@ class General extends Component
'key' => "SERVICE_FQDN_{$serviceNameFormatted}", 'key' => "SERVICE_FQDN_{$serviceNameFormatted}",
], [ ], [
'value' => $fqdnValue, 'value' => $fqdnValue,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
@@ -712,7 +711,6 @@ class General extends Component
'key' => "SERVICE_URL_{$serviceNameFormatted}", 'key' => "SERVICE_URL_{$serviceNameFormatted}",
], [ ], [
'value' => $urlValue, 'value' => $urlValue,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
// Create/update port-specific variables if port exists // Create/update port-specific variables if port exists
@@ -721,7 +719,6 @@ class General extends Component
'key' => "SERVICE_FQDN_{$serviceNameFormatted}_{$port}", 'key' => "SERVICE_FQDN_{$serviceNameFormatted}_{$port}",
], [ ], [
'value' => $fqdnValue, 'value' => $fqdnValue,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
@@ -729,7 +726,6 @@ class General extends Component
'key' => "SERVICE_URL_{$serviceNameFormatted}_{$port}", 'key' => "SERVICE_URL_{$serviceNameFormatted}_{$port}",
], [ ], [
'value' => $urlValue, 'value' => $urlValue,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} }

View File

@@ -63,7 +63,6 @@ class DockerCompose extends Component
EnvironmentVariable::create([ EnvironmentVariable::create([
'key' => $key, 'key' => $key,
'value' => $variable, 'value' => $variable,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
'resourceable_id' => $service->id, 'resourceable_id' => $service->id,
'resourceable_type' => $service->getMorphClass(), 'resourceable_type' => $service->getMorphClass(),

View File

@@ -97,7 +97,6 @@ class Create extends Component
'value' => $value, 'value' => $value,
'resourceable_id' => $service->id, 'resourceable_id' => $service->id,
'resourceable_type' => $service->getMorphClass(), 'resourceable_type' => $service->getMorphClass(),
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} }

View File

@@ -19,8 +19,6 @@ class Add extends Component
public ?string $value = null; public ?string $value = null;
public bool $is_build_time = false;
public bool $is_multiline = false; public bool $is_multiline = false;
public bool $is_literal = false; public bool $is_literal = false;
@@ -30,7 +28,6 @@ class Add extends Component
protected $rules = [ protected $rules = [
'key' => 'required|string', 'key' => 'required|string',
'value' => 'nullable', 'value' => 'nullable',
'is_build_time' => 'required|boolean',
'is_multiline' => 'required|boolean', 'is_multiline' => 'required|boolean',
'is_literal' => 'required|boolean', 'is_literal' => 'required|boolean',
]; ];
@@ -38,7 +35,6 @@ class Add extends Component
protected $validationAttributes = [ protected $validationAttributes = [
'key' => 'key', 'key' => 'key',
'value' => 'value', 'value' => 'value',
'is_build_time' => 'build',
'is_multiline' => 'multiline', 'is_multiline' => 'multiline',
'is_literal' => 'literal', 'is_literal' => 'literal',
]; ];
@@ -54,7 +50,6 @@ class Add extends Component
$this->dispatch('saveKey', [ $this->dispatch('saveKey', [
'key' => $this->key, 'key' => $this->key,
'value' => $this->value, 'value' => $this->value,
'is_build_time' => $this->is_build_time,
'is_multiline' => $this->is_multiline, 'is_multiline' => $this->is_multiline,
'is_literal' => $this->is_literal, 'is_literal' => $this->is_literal,
'is_preview' => $this->is_preview, 'is_preview' => $this->is_preview,
@@ -66,7 +61,6 @@ class Add extends Component
{ {
$this->key = ''; $this->key = '';
$this->value = ''; $this->value = '';
$this->is_build_time = false;
$this->is_multiline = false; $this->is_multiline = false;
$this->is_literal = false; $this->is_literal = false;
} }

View File

@@ -212,7 +212,6 @@ class All extends Component
$environment = new EnvironmentVariable; $environment = new EnvironmentVariable;
$environment->key = $data['key']; $environment->key = $data['key'];
$environment->value = $data['value']; $environment->value = $data['value'];
$environment->is_build_time = $data['is_build_time'] ?? false;
$environment->is_multiline = $data['is_multiline'] ?? false; $environment->is_multiline = $data['is_multiline'] ?? false;
$environment->is_literal = $data['is_literal'] ?? false; $environment->is_literal = $data['is_literal'] ?? false;
$environment->is_preview = $data['is_preview'] ?? false; $environment->is_preview = $data['is_preview'] ?? false;
@@ -276,7 +275,6 @@ class All extends Component
$environment = new EnvironmentVariable; $environment = new EnvironmentVariable;
$environment->key = $key; $environment->key = $key;
$environment->value = $value; $environment->value = $value;
$environment->is_build_time = false;
$environment->is_multiline = false; $environment->is_multiline = false;
$environment->is_preview = $isPreview; $environment->is_preview = $isPreview;
$environment->resourceable_id = $this->resource->id; $environment->resourceable_id = $this->resource->id;

View File

@@ -32,8 +32,6 @@ class Show extends Component
public bool $is_shared = false; public bool $is_shared = false;
public bool $is_build_time = false;
public bool $is_multiline = false; public bool $is_multiline = false;
public bool $is_literal = false; public bool $is_literal = false;
@@ -55,7 +53,6 @@ class Show extends Component
protected $rules = [ protected $rules = [
'key' => 'required|string', 'key' => 'required|string',
'value' => 'nullable', 'value' => 'nullable',
'is_build_time' => 'required|boolean',
'is_multiline' => 'required|boolean', 'is_multiline' => 'required|boolean',
'is_literal' => 'required|boolean', 'is_literal' => 'required|boolean',
'is_shown_once' => 'required|boolean', 'is_shown_once' => 'required|boolean',
@@ -101,7 +98,6 @@ class Show extends Component
]); ]);
} else { } else {
$this->validate(); $this->validate();
$this->env->is_build_time = $this->is_build_time;
$this->env->is_required = $this->is_required; $this->env->is_required = $this->is_required;
$this->env->is_shared = $this->is_shared; $this->env->is_shared = $this->is_shared;
} }
@@ -114,7 +110,6 @@ class Show extends Component
} else { } else {
$this->key = $this->env->key; $this->key = $this->env->key;
$this->value = $this->env->value; $this->value = $this->env->value;
$this->is_build_time = $this->env->is_build_time ?? false;
$this->is_multiline = $this->env->is_multiline; $this->is_multiline = $this->env->is_multiline;
$this->is_literal = $this->env->is_literal; $this->is_literal = $this->env->is_literal;
$this->is_shown_once = $this->env->is_shown_once; $this->is_shown_once = $this->env->is_shown_once;
@@ -139,9 +134,6 @@ class Show extends Component
public function serialize() public function serialize()
{ {
data_forget($this->env, 'real_value'); data_forget($this->env, 'real_value');
if ($this->env->getMorphClass() === \App\Models\SharedEnvironmentVariable::class) {
data_forget($this->env, 'is_build_time');
}
} }
public function lock() public function lock()

View File

@@ -738,14 +738,6 @@ class Application extends BaseModel
->where('key', 'not like', 'NIXPACKS_%'); ->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() public function nixpacks_environment_variables()
{ {
return $this->morphMany(EnvironmentVariable::class, 'resourceable') return $this->morphMany(EnvironmentVariable::class, 'resourceable')
@@ -767,14 +759,6 @@ class Application extends BaseModel
->where('key', 'not like', 'NIXPACKS_%'); ->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() public function nixpacks_environment_variables_preview()
{ {
return $this->morphMany(EnvironmentVariable::class, 'resourceable') 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); $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) { 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 { } 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); $newConfigHash = md5($newConfigHash);
$oldConfigHash = data_get($this, 'config_hash'); $oldConfigHash = data_get($this, 'config_hash');

View File

@@ -14,7 +14,6 @@ use OpenApi\Attributes as OA;
'uuid' => ['type' => 'string'], 'uuid' => ['type' => 'string'],
'resourceable_type' => ['type' => 'string'], 'resourceable_type' => ['type' => 'string'],
'resourceable_id' => ['type' => 'integer'], 'resourceable_id' => ['type' => 'integer'],
'is_build_time' => ['type' => 'boolean'],
'is_literal' => ['type' => 'boolean'], 'is_literal' => ['type' => 'boolean'],
'is_multiline' => ['type' => 'boolean'], 'is_multiline' => ['type' => 'boolean'],
'is_preview' => ['type' => 'boolean'], 'is_preview' => ['type' => 'boolean'],
@@ -35,7 +34,6 @@ class EnvironmentVariable extends BaseModel
protected $casts = [ protected $casts = [
'key' => 'string', 'key' => 'string',
'value' => 'encrypted', 'value' => 'encrypted',
'is_build_time' => 'boolean',
'is_multiline' => 'boolean', 'is_multiline' => 'boolean',
'is_preview' => 'boolean', 'is_preview' => 'boolean',
'version' => 'string', 'version' => 'string',
@@ -61,7 +59,6 @@ class EnvironmentVariable extends BaseModel
ModelsEnvironmentVariable::create([ ModelsEnvironmentVariable::create([
'key' => $environment_variable->key, 'key' => $environment_variable->key,
'value' => $environment_variable->value, 'value' => $environment_variable->value,
'is_build_time' => $environment_variable->is_build_time,
'is_multiline' => $environment_variable->is_multiline ?? false, 'is_multiline' => $environment_variable->is_multiline ?? false,
'is_literal' => $environment_variable->is_literal ?? false, 'is_literal' => $environment_variable->is_literal ?? false,
'resourceable_type' => Application::class, 'resourceable_type' => Application::class,

View File

@@ -1113,7 +1113,6 @@ class Service extends BaseModel
$this->environment_variables()->create([ $this->environment_variables()->create([
'key' => $key, 'key' => $key,
'value' => $value, 'value' => $value,
'is_build_time' => false,
'resourceable_id' => $this->id, 'resourceable_id' => $this->id,
'resourceable_type' => $this->getMorphClass(), 'resourceable_type' => $this->getMorphClass(),
'is_preview' => false, 'is_preview' => false,

View File

@@ -129,7 +129,6 @@ class ConfigurationGenerator
$variables->push([ $variables->push([
'key' => $env->key, 'key' => $env->key,
'value' => $env->value, 'value' => $env->value,
'is_build_time' => $env->is_build_time,
'is_preview' => $env->is_preview, 'is_preview' => $env->is_preview,
'is_multiline' => $env->is_multiline, 'is_multiline' => $env->is_multiline,
]); ]);
@@ -145,7 +144,6 @@ class ConfigurationGenerator
$variables->push([ $variables->push([
'key' => $env->key, 'key' => $env->key,
'value' => $env->value, 'value' => $env->value,
'is_build_time' => $env->is_build_time,
'is_preview' => $env->is_preview, 'is_preview' => $env->is_preview,
'is_multiline' => $env->is_multiline, 'is_multiline' => $env->is_multiline,
]); ]);

View File

@@ -342,7 +342,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $fqdn, 'value' => $fqdn,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} }
@@ -355,7 +354,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $fqdn, 'value' => $fqdn,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} }
@@ -384,7 +382,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $fqdn, 'value' => $fqdn,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
if ($resource->build_pack === 'dockercompose') { if ($resource->build_pack === 'dockercompose') {
@@ -418,7 +415,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $url, 'value' => $url,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
if ($resource->build_pack === 'dockercompose') { if ($resource->build_pack === 'dockercompose') {
@@ -446,7 +442,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $value, 'value' => $value,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} }
@@ -760,7 +755,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $value, 'value' => $value,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
@@ -777,7 +771,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $value, 'value' => $value,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} else { } else {
@@ -813,7 +806,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_type' => get_class($resource), 'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
'is_required' => $isRequired, 'is_required' => $isRequired,
]); ]);
@@ -828,7 +820,6 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $value, 'value' => $value,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
'is_required' => $isRequired, '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('.', '_'), 'key' => 'SERVICE_URL_'.str($forServiceName)->upper()->replace('-', '_')->replace('.', '_'),
], [ ], [
'value' => $coolifyUrl->__toString(), 'value' => $coolifyUrl->__toString(),
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
$resource->environment_variables()->updateOrCreate([ $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('.', '_'), 'key' => 'SERVICE_FQDN_'.str($forServiceName)->upper()->replace('-', '_')->replace('.', '_'),
], [ ], [
'value' => $coolifyFqdn, 'value' => $coolifyFqdn,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} else { } else {
@@ -1343,7 +1332,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $fqdn, 'value' => $fqdn,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
$resource->environment_variables()->updateOrCreate([ $resource->environment_variables()->updateOrCreate([
@@ -1352,7 +1340,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $url, 'value' => $url,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} }
@@ -1364,7 +1351,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $fqdn, 'value' => $fqdn,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
$resource->environment_variables()->updateOrCreate([ $resource->environment_variables()->updateOrCreate([
@@ -1373,7 +1359,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $url, 'value' => $url,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} }
@@ -1403,7 +1388,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $fqdn, 'value' => $fqdn,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
@@ -1423,7 +1407,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $url, 'value' => $url,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
@@ -1435,7 +1418,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $value, 'value' => $value,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} }
@@ -1754,7 +1736,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $value, 'value' => $value,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
@@ -1771,7 +1752,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $value, 'value' => $value,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} else { } else {
@@ -1807,7 +1787,6 @@ function serviceParser(Service $resource): Collection
'resourceable_type' => get_class($resource), 'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
'is_required' => $isRequired, 'is_required' => $isRequired,
]); ]);
@@ -1822,7 +1801,6 @@ function serviceParser(Service $resource): Collection
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $value, 'value' => $value,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
'is_required' => $isRequired, 'is_required' => $isRequired,
]); ]);

View File

@@ -133,7 +133,6 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource)
'key' => $variableName, 'key' => $variableName,
], [ ], [
'value' => $urlValue, 'value' => $urlValue,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
if ($port) { if ($port) {
@@ -144,7 +143,6 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource)
'key' => $variableName, 'key' => $variableName,
], [ ], [
'value' => $urlValue, 'value' => $urlValue,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} }
@@ -163,7 +161,6 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource)
'key' => $variableName, 'key' => $variableName,
], [ ], [
'value' => $fqdnValue, 'value' => $fqdnValue,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
if ($port) { if ($port) {
@@ -174,7 +171,6 @@ function updateCompose(ServiceApplication|ServiceDatabase $resource)
'key' => $variableName, 'key' => $variableName,
], [ ], [
'value' => $fqdnValue, 'value' => $fqdnValue,
'is_build_time' => false,
'is_preview' => false, 'is_preview' => false,
]); ]);
} }

View File

@@ -1564,7 +1564,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
EnvironmentVariable::create([ EnvironmentVariable::create([
'key' => $key, 'key' => $key,
'value' => $fqdn, 'value' => $fqdn,
'is_build_time' => false,
'resourceable_type' => get_class($resource), 'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
'is_preview' => false, 'is_preview' => false,
@@ -1644,7 +1643,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
EnvironmentVariable::create([ EnvironmentVariable::create([
'key' => $key, 'key' => $key,
'value' => $fqdn, 'value' => $fqdn,
'is_build_time' => false,
'resourceable_type' => get_class($resource), 'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
'is_preview' => false, 'is_preview' => false,
@@ -1683,7 +1681,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
EnvironmentVariable::create([ EnvironmentVariable::create([
'key' => $key, 'key' => $key,
'value' => $generatedValue, 'value' => $generatedValue,
'is_build_time' => false,
'resourceable_type' => get_class($resource), 'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
'is_preview' => false, 'is_preview' => false,
@@ -1722,7 +1719,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
], [ ], [
'value' => $defaultValue, 'value' => $defaultValue,
'is_build_time' => false,
'resourceable_type' => get_class($resource), 'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
'is_preview' => false, 'is_preview' => false,
@@ -2413,7 +2409,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
EnvironmentVariable::create([ EnvironmentVariable::create([
'key' => $key, 'key' => $key,
'value' => $fqdn, 'value' => $fqdn,
'is_build_time' => false,
'resourceable_type' => get_class($resource), 'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
'is_preview' => false, 'is_preview' => false,
@@ -2425,7 +2420,6 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
EnvironmentVariable::create([ EnvironmentVariable::create([
'key' => $key, 'key' => $key,
'value' => $generatedValue, 'value' => $generatedValue,
'is_build_time' => false,
'resourceable_type' => get_class($resource), 'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
'is_preview' => false, 'is_preview' => false,
@@ -2459,20 +2453,17 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
if ($foundEnv) { if ($foundEnv) {
$defaultValue = data_get($foundEnv, 'value'); $defaultValue = data_get($foundEnv, 'value');
} }
$isBuildTime = data_get($foundEnv, 'is_build_time', false);
if ($foundEnv) { if ($foundEnv) {
$foundEnv->update([ $foundEnv->update([
'key' => $key, 'key' => $key,
'resourceable_type' => get_class($resource), 'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
'is_build_time' => $isBuildTime,
'value' => $defaultValue, 'value' => $defaultValue,
]); ]);
} else { } else {
EnvironmentVariable::create([ EnvironmentVariable::create([
'key' => $key, 'key' => $key,
'value' => $defaultValue, 'value' => $defaultValue,
'is_build_time' => $isBuildTime,
'resourceable_type' => get_class($resource), 'resourceable_type' => get_class($resource),
'resourceable_id' => $resource->id, 'resourceable_id' => $resource->id,
'is_preview' => false, 'is_preview' => false,

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('environment_variables', function (Blueprint $table) {
// Check if the column exists before trying to drop it
if (Schema::hasColumn('environment_variables', 'is_build_time')) {
// Drop the is_build_time column
// Note: The unique constraints that included is_build_time were tied to old foreign key columns
// (application_id, service_id, database_id) which were removed in migration 2024_12_16_134437.
// Those constraints should no longer exist in the database.
$table->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');
}
});
}
};

View File

@@ -3,11 +3,6 @@
<x-forms.textarea x-show="$wire.is_multiline === true" x-cloak id="value" label="Value" required /> <x-forms.textarea x-show="$wire.is_multiline === true" x-cloak id="value" label="Value" required />
<x-forms.input x-show="$wire.is_multiline === false" x-cloak placeholder="production" id="value" <x-forms.input x-show="$wire.is_multiline === false" x-cloak placeholder="production" id="value"
x-bind:label="$wire.is_multiline === false && 'Value'" required /> x-bind:label="$wire.is_multiline === false && 'Value'" required />
@if (data_get($parameters, 'application_uuid'))
<x-forms.checkbox 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}'`"
label="Is Build Variable?" />
@endif
<x-forms.checkbox id="is_multiline" label="Is Multiline?" /> <x-forms.checkbox id="is_multiline" label="Is Multiline?" />
@if (!$shared) @if (!$shared)
<x-forms.checkbox id="is_literal" <x-forms.checkbox id="is_literal"

View File

@@ -58,18 +58,12 @@
<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_redis_credential) @if (!$is_redis_credential)
@if ($type === 'service') @if ($type === 'service')
<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}'`"
label="Is Build Variable?" />
<x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" /> <x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" />
<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?" />
@else @else
@if ($is_shared) @if ($is_shared)
<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}'`"
label="Is 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?" />
@@ -77,9 +71,6 @@
@if ($isSharedVariable) @if ($isSharedVariable)
<x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" /> <x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" />
@else @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="Is Build Variable?" />
<x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" /> <x-forms.checkbox instantSave id="is_multiline" label="Is Multiline?" />
@if ($is_multiline === false) @if ($is_multiline === false)
<x-forms.checkbox instantSave id="is_literal" <x-forms.checkbox instantSave id="is_literal"
@@ -123,18 +114,12 @@
<div class="flex flex-col w-full gap-2 flex-wrap lg:flex-row"> <div class="flex flex-col w-full gap-2 flex-wrap lg:flex-row">
@if (!$is_redis_credential) @if (!$is_redis_credential)
@if ($type === 'service') @if ($type === 'service')
<x-forms.checkbox disabled 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}'`"
label="Is Build Variable?" />
<x-forms.checkbox disabled id="is_multiline" label="Is Multiline?" /> <x-forms.checkbox disabled id="is_multiline" label="Is Multiline?" />
<x-forms.checkbox disabled id="is_literal" <x-forms.checkbox disabled 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?" />
@else @else
@if ($is_shared) @if ($is_shared)
<x-forms.checkbox disabled 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}'`"
label="Is Build Variable?" />
<x-forms.checkbox disabled id="is_literal" <x-forms.checkbox disabled 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?" />
@@ -142,9 +127,6 @@
@if ($isSharedVariable) @if ($isSharedVariable)
<x-forms.checkbox disabled id="is_multiline" label="Is Multiline?" /> <x-forms.checkbox disabled id="is_multiline" label="Is Multiline?" />
@else @else
<x-forms.checkbox disabled 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="Is Build Variable?" />
<x-forms.checkbox disabled id="is_multiline" label="Is Multiline?" /> <x-forms.checkbox disabled id="is_multiline" label="Is Multiline?" />
@if ($is_multiline === false) @if ($is_multiline === false)
<x-forms.checkbox disabled id="is_literal" <x-forms.checkbox disabled id="is_literal"