summary refs log tree commit diff
path: root/src/util
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-12-23 13:05:37 +1100
committerPuyodead1 <puyodead@proton.me>2023-03-18 19:25:03 -0400
commit8ff3767d3232fef9ad3c543af8b16a13a999fac0 (patch)
tree5eb2ce92d734e4a4033c258cc6af0fe19fd0e35d /src/util
parentFollow Discord docs for `visibility` and `metadata_visibility` fields in Conn... (diff)
downloadserver-8ff3767d3232fef9ad3c543af8b16a13a999fac0.tar.xz
Fix ConnectionLoader from throwing when uploading default config keys
Diffstat (limited to 'src/util')
-rw-r--r--src/util/connections/ConnectionLoader.ts18
1 files changed, 8 insertions, 10 deletions
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) || {}))
+		});
 	}
 }