Cast runnableEnv items to string

This commit is contained in:
HKalbasi 2022-10-12 20:40:49 +03:30 committed by GitHub
parent a0ab61fb6c
commit 983ae1b1c9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -133,7 +133,21 @@ export class Config {
}
get runnableEnv() {
return this.get<RunnableEnvCfg>("runnableEnv");
const item = this.get<any>("runnableEnv");
if (!item) return item;
const fixRecord = (r: Record<string, any>) => {
for (const key in r) {
if (typeof r[key] !== 'string') {
r[key] = String(r[key]);
}
}
};
if (item instanceof Array) {
item.forEach((x) => fixRecord(x.env));
} else {
fixRecord(item);
}
return item;
}
get restartServerOnConfigChange() {