feat(environment): introduce 'is_buildtime_only' attribute to environment variables for improved build-time configuration

This commit is contained in:
Andras Bacsai
2025-09-11 17:38:16 +02:00
parent 6d477ff593
commit 20ad2165e7
9 changed files with 83 additions and 2 deletions

View File

@@ -911,7 +911,11 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
});
if ($this->pull_request_id === 0) {
$this->env_filename = '.env';
foreach ($sorted_environment_variables as $env) {
// Filter out buildtime-only variables from runtime environment
$runtime_environment_variables = $sorted_environment_variables->filter(function ($env) {
return ! $env->is_buildtime_only;
});
foreach ($runtime_environment_variables as $env) {
$envs->push($env->key.'='.$env->real_value);
}
// Add PORT if not exists, use the first port as default
@@ -955,7 +959,11 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
}
} else {
$this->env_filename = '.env';
foreach ($sorted_environment_variables_preview as $env) {
// Filter out buildtime-only variables from runtime environment for preview
$runtime_environment_variables_preview = $sorted_environment_variables_preview->filter(function ($env) {
return ! $env->is_buildtime_only;
});
foreach ($runtime_environment_variables_preview as $env) {
$envs->push($env->key.'='.$env->real_value);
}
// Add PORT if not exists, use the first port as default