mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
Enhance environment variable handling in processTemplate: support boolean and number types in env configuration, with tests for both array and object formats.
This commit is contained in:
@@ -45,7 +45,9 @@ export interface CompleteTemplate {
|
||||
variables: Record<string, string>;
|
||||
config: {
|
||||
domains: DomainConfig[];
|
||||
env: Record<string, string> | string[];
|
||||
env:
|
||||
| Record<string, string | boolean | number>
|
||||
| (string | Record<string, string | boolean | number>)[];
|
||||
mounts?: MountConfig[];
|
||||
};
|
||||
}
|
||||
@@ -200,7 +202,16 @@ export function processEnvVars(
|
||||
if (typeof env === "string") {
|
||||
return processValue(env, variables, schema);
|
||||
}
|
||||
return env;
|
||||
// Si es un objeto, asumimos que es un par clave-valor
|
||||
if (typeof env === "object" && env !== null) {
|
||||
const keys = Object.keys(env);
|
||||
if (keys.length > 0) {
|
||||
const key = keys[0];
|
||||
return `${key}=${env[key as keyof typeof env]}`;
|
||||
}
|
||||
}
|
||||
// Para valores primitivos (boolean, number)
|
||||
return String(env);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user