mirror of
https://github.com/xuthus83/pigallery2.git
synced 2025-01-14 14:43:17 +08: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.processHierarchyVar(configObject, varAliases);
|
||||||
this.loadObject(configObject, process.env);
|
this.processHierarchyVar(configObject, process.env);
|
||||||
};
|
};
|
||||||
|
|
||||||
private static processArguments(configObject: any) {
|
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) => {
|
Object.keys(sourceObject).forEach((key) => {
|
||||||
if (typeof targetObject[key] === "undefined") {
|
if (typeof targetObject[key] === "undefined") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (typeof targetObject[key] === "object") {
|
|
||||||
this.loadObject(targetObject[key], sourceObject[key]);
|
if (Array.isArray(targetObject[key])) {
|
||||||
} else {
|
return targetObject[key] = sourceObject[key];
|
||||||
targetObject[key] = sourceObject[key];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof targetObject[key] === "object") {
|
||||||
|
return this.loadObject(targetObject[key], sourceObject[key]);
|
||||||
|
}
|
||||||
|
|
||||||
|
targetObject[key] = sourceObject[key];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user