mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-26 04:03:03 +01:00
Add mostly-functional initial setup script
This commit is contained in:
parent
c0e00d04c0
commit
c0c939fb80
@ -12,7 +12,7 @@ let lines3 = lines2.filter((y) => y.includes(": BitFlag("));
|
||||
let lines4 = lines3.map((x) => x.split("//")[0].trim());
|
||||
|
||||
function BitFlag(int) {
|
||||
return 1n << eval(`${int}n`);
|
||||
return 1n << BigInt(int);
|
||||
}
|
||||
|
||||
let rights = [];
|
||||
|
@ -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(),
|
||||
};
|
||||
"example-plugin": new example_plugin.default()
|
||||
};
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user