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