feat(railpack): expose COOLIFY_* vars at build time and generalize buildpack control flag

Mirrors Nixpacks behavior: inject COOLIFY_* and SOURCE_COMMIT into
railpack build variables so apps (e.g. SPAs baking public URLs) can
read them via /run/secrets/<KEY>.

Rename is_nixpacks → is_buildpack_control to cover both NIXPACKS_ and
RAILPACK_ prefixed keys. Update the env variable view and appends list
accordingly.

Promote generate_coolify_env_variables to protected for testability.
This commit is contained in:
Andras Bacsai committed 2026-04-30 18:31:41 +02:00
1 parent 21eac6654f
commit b6ca6b1b20
5 files changed
+122 -14

No files matched your search

+9 -1
View File
@@ -2527,6 +2527,14 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
$variables->put('RAILPACK_INSTALL_CMD', $this->application->install_command);
}
// Mirror Nixpacks behavior: expose COOLIFY_* and SOURCE_COMMIT to the build so apps
// (e.g. SPAs baking the public URL) can read them via /run/secrets/<KEY>.
foreach ($this->generate_coolify_env_variables(forBuildTime: true) as $key => $value) {
if (! is_null($value) && $value !== '') {
$variables->put($key, $value);
}
}
return $variables;
}
@@ -2829,7 +2837,7 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
);
}
private function generate_coolify_env_variables(bool $forBuildTime = false): Collection
protected function generate_coolify_env_variables(bool $forBuildTime = false): Collection
{
$coolify_envs = collect([]);
$local_branch = $this->branch;