summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTheArcaneBrony <myrainbowdash949@gmail.com>2022-08-18 22:17:36 +0200
committerTheArcaneBrony <myrainbowdash949@gmail.com>2022-09-04 10:48:54 +0200
commitc0c939fb800488fe7bc5cab38079e35dea232652 (patch)
treeb003eb76a2c67e5c61489a2fa9a61a1092e5d816 /src
parentAdd fallback to bcryptjs, make canvas optional (diff)
downloadserver-c0c939fb800488fe7bc5cab38079e35dea232652.tar.xz
Add mostly-functional initial setup script
Diffstat (limited to 'src')
-rw-r--r--src/plugins/PluginIndex.ts5
-rw-r--r--src/util/util/Config.ts9
2 files changed, 11 insertions, 3 deletions
diff --git a/src/plugins/PluginIndex.ts b/src/plugins/PluginIndex.ts
index 502161a1..2688d0bf 100644
--- a/src/plugins/PluginIndex.ts
+++ b/src/plugins/PluginIndex.ts
@@ -1,6 +1,5 @@
-import { Plugin } from "util/plugin";
 import * as example_plugin from "./example-plugin/TestPlugin";
 
 export const PluginIndex: any = {
-    "example-plugin": new example_plugin.default(),
-};
\ No newline at end of file
+	"example-plugin": new example_plugin.default()
+};
diff --git a/src/util/util/Config.ts b/src/util/util/Config.ts
index 49a1f3f8..2879b955 100644
--- a/src/util/util/Config.ts
+++ b/src/util/util/Config.ts
@@ -5,6 +5,7 @@ import { ConfigValue } from "../config";
 import { ConfigEntity } from "../entities/Config";
 
 const overridePath = process.env.CONFIG_PATH ?? "";
+const initialPath = path.join(process.cwd(), "initial.json");
 
 let config: ConfigValue;
 let pairs: ConfigEntity[];
@@ -28,6 +29,14 @@ export const Config = {
 			} catch (error) {
 				fs.writeFileSync(overridePath, JSON.stringify(config, null, 4));
 			}
+		if (fs.existsSync(initialPath)) {
+			console.log("[Config] Importing initial configuration...");
+			try {
+				const overrideConfig = JSON.parse(fs.readFileSync(initialPath, { encoding: "utf8" }));
+				config = overrideConfig.merge(config);
+				fs.rmSync(initialPath);
+			} catch (error) {}
+		}
 
 		if (fs.existsSync(path.join(process.cwd(), "initial.json")))
 			try {