summary refs log tree commit diff
diff options
context:
space:
mode:
authorMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-12-19 20:39:43 +1100
committerMadeline <46743919+MaddyUnderStars@users.noreply.github.com>2022-12-19 20:39:43 +1100
commitbee07a3104336076283aece9ecd37f1cf070ddf1 (patch)
treec66961412b46e85748b0f794ebbcb7a551c455f1
parentimplement guild profiles and fix user profiles (diff)
downloadserver-bee07a3104336076283aece9ecd37f1cf070ddf1.tar.xz
Fix config loading
-rw-r--r--src/util/util/Config.ts6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/util/util/Config.ts b/src/util/util/Config.ts
index 18e0b76c..f5758212 100644
--- a/src/util/util/Config.ts
+++ b/src/util/util/Config.ts
@@ -14,12 +14,16 @@ var pairs: ConfigEntity[];
 export const Config = {
 	init: async function init() {
 		if (config) return config;
-		console.log('[Config] Loading configuration...')
+		console.log('[Config] Loading configuration...');
 		pairs = await ConfigEntity.find();
 		config = pairsToConfig(pairs);
 		// TODO: this overwrites existing config values with defaults.
 		// we actually want to extend the object with new keys instead.
 		// config = (config || {}).merge(new ConfigValue());
+		// Object.assign(config, new ConfigValue());
+
+		// If a config doesn't exist, create it.
+		if (Object.keys(config).length == 0) config = new ConfigValue();
 
 		if (process.env.CONFIG_PATH) {
 			console.log(`[Config] Using config path from environment rather than database.`);