Fix ConnectionLoader from throwing when uploading default config keys
This commit is contained in:
parent
a390596e3c
commit
8ff3767d32
@ -34,10 +34,12 @@ export class ConnectionLoader {
|
|||||||
public static getConnectionConfig(id: string, defaults?: any): any {
|
public static getConnectionConfig(id: string, defaults?: any): any {
|
||||||
let cfg = ConnectionConfig.get()[id];
|
let cfg = ConnectionConfig.get()[id];
|
||||||
if (defaults) {
|
if (defaults) {
|
||||||
if (cfg) cfg = OrmUtils.mergeDeep(defaults, cfg);
|
if (cfg) cfg = Object.assign({}, defaults, cfg);
|
||||||
else cfg = defaults;
|
else {
|
||||||
|
cfg = defaults;
|
||||||
this.setConnectionConfig(id, cfg);
|
this.setConnectionConfig(id, cfg);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!cfg)
|
if (!cfg)
|
||||||
console.log(
|
console.log(
|
||||||
@ -55,12 +57,8 @@ export class ConnectionLoader {
|
|||||||
`[ConnectionConfig/WARN] ${id} tried to set config=null!`,
|
`[ConnectionConfig/WARN] ${id} tried to set config=null!`,
|
||||||
);
|
);
|
||||||
|
|
||||||
const a = {
|
await ConnectionConfig.set({
|
||||||
[id]: OrmUtils.mergeDeep(
|
[id]: Object.assign(config, (ConnectionLoader.getConnectionConfig(id) || {}))
|
||||||
ConnectionLoader.getConnectionConfig(id) || {},
|
});
|
||||||
config,
|
|
||||||
),
|
|
||||||
};
|
|
||||||
await ConnectionConfig.set(a);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user