feat: add params as JSON placeholders with !!! prefix

This commit is contained in:
sokol
2026-02-18 16:19:41 +03:00
parent ddc5311fb9
commit acce21c0e6

View File

@@ -62,8 +62,8 @@ export class Config {
/**
* Updates the template JSON by adding/updating params from the given environment.
* Params are added as "paramName": "paramValue" pairs.
* Existing params in template are preserved if not in the env.
* Params are added as "!!! paramName": "@paramName@" placeholder pairs.
* Existing template content is preserved.
*/
updateTemplateFromEnv(env: Env) {
let templateObj: Record<string, any> = {};
@@ -78,10 +78,12 @@ export class Config {
console.warn("Template is not valid JSON, starting fresh");
}
// Add/update params from the environment
// Add/update params from the environment as placeholders
for (const param of env.params) {
if (param.name && param.name.trim() !== "") {
templateObj[param.name] = param.value ?? "";
const placeholderKey = `!!! ${param.name}`;
const placeholderValue = `@${param.name}@`;
templateObj[placeholderKey] = placeholderValue;
}
}