Skip to content

Commit

Permalink
Add mostly-functional initial setup script
Browse files Browse the repository at this point in the history
  • Loading branch information
TheArcaneBrony committed Aug 20, 2022
1 parent 7a5667e commit 5473e07
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/rights.js
Expand Up @@ -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 = [];
Expand Down
5 changes: 2 additions & 3 deletions 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(),
};
"example-plugin": new example_plugin.default()
};
10 changes: 10 additions & 0 deletions src/util/util/Config.ts
@@ -1,9 +1,11 @@
import fs from "fs";
import path from "path";
import { OrmUtils } from ".";
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[];
Expand All @@ -27,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) {}
}

return this.set(config);
},
Expand Down

0 comments on commit 5473e07

Please sign in to comment.