From 8ff3767d3232fef9ad3c543af8b16a13a999fac0 Mon Sep 17 00:00:00 2001 From: Madeline <46743919+MaddyUnderStars@users.noreply.github.com> Date: Fri, 23 Dec 2022 13:05:37 +1100 Subject: Fix ConnectionLoader from throwing when uploading default config keys --- src/util/connections/ConnectionLoader.ts | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/util/connections/ConnectionLoader.ts b/src/util/connections/ConnectionLoader.ts index 7467739c..04d7752a 100644 --- a/src/util/connections/ConnectionLoader.ts +++ b/src/util/connections/ConnectionLoader.ts @@ -34,9 +34,11 @@ export class ConnectionLoader { public static getConnectionConfig(id: string, defaults?: any): any { let cfg = ConnectionConfig.get()[id]; if (defaults) { - if (cfg) cfg = OrmUtils.mergeDeep(defaults, cfg); - else cfg = defaults; - this.setConnectionConfig(id, cfg); + if (cfg) cfg = Object.assign({}, defaults, cfg); + else { + cfg = defaults; + this.setConnectionConfig(id, cfg); + } } if (!cfg) @@ -55,12 +57,8 @@ export class ConnectionLoader { `[ConnectionConfig/WARN] ${id} tried to set config=null!`, ); - const a = { - [id]: OrmUtils.mergeDeep( - ConnectionLoader.getConnectionConfig(id) || {}, - config, - ), - }; - await ConnectionConfig.set(a); + await ConnectionConfig.set({ + [id]: Object.assign(config, (ConnectionLoader.getConnectionConfig(id) || {})) + }); } } -- cgit 1.4.1