mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-01-14 04:35:56 +02:00
fixing config loading
This commit is contained in:
parent
935b723bdb
commit
374aa35dd2
@ -18,7 +18,7 @@ export class ConfigLoader {
|
||||
}
|
||||
});
|
||||
this.processHierarchyVar(configObject, varAliases);
|
||||
this.loadObject(configObject, process.env);
|
||||
this.processHierarchyVar(configObject, process.env);
|
||||
};
|
||||
|
||||
private static processArguments(configObject: any) {
|
||||
@ -95,16 +95,22 @@ export class ConfigLoader {
|
||||
}
|
||||
}
|
||||
|
||||
private static loadObject(targetObject: any, sourceObject: any) {
|
||||
|
||||
private static loadObject(targetObject, sourceObject) {
|
||||
Object.keys(sourceObject).forEach((key) => {
|
||||
if (typeof targetObject[key] === "undefined") {
|
||||
return;
|
||||
}
|
||||
if (typeof targetObject[key] === "object") {
|
||||
this.loadObject(targetObject[key], sourceObject[key]);
|
||||
} else {
|
||||
targetObject[key] = sourceObject[key];
|
||||
|
||||
if (Array.isArray(targetObject[key])) {
|
||||
return targetObject[key] = sourceObject[key];
|
||||
}
|
||||
|
||||
if (typeof targetObject[key] === "object") {
|
||||
return this.loadObject(targetObject[key], sourceObject[key]);
|
||||
}
|
||||
|
||||
targetObject[key] = sourceObject[key];
|
||||
});
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user