fix[railpack]: environment variable validation for empty strings

Allow empty string values to be processed as valid environment
variables by checking for existence rather than non-empty length.
This commit is contained in:
Torsten Dittmann 2025-06-01 22:21:53 +02:00
parent 9535276fe6
commit 7f9c19bc11

View File

@ -86,7 +86,7 @@ export const buildRailpack = async (
const env: { [key: string]: string } = {};
for (const pair of envVariables) {
const [key, value] = parseEnvironmentKeyValuePair(pair);
if (key && value.length > 0) {
if (key && value) {
buildArgs.push("--secret", `id=${key},env=${key}`);
env[key] = value;
}
@ -166,7 +166,7 @@ export const getRailpackCommand = (
const exportEnvs = [];
for (const pair of envVariables) {
const [key, value] = parseEnvironmentKeyValuePair(pair);
if (key && value.length > 0) {
if (key && value) {
buildArgs.push("--secret", `id=${key},env=${key}`);
exportEnvs.push(`export ${key}='${value}'`);
}