ai #1
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user