1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-11 13:14:06 +01:00
server/src/Config.ts
2021-02-05 15:19:32 +01:00

31 lines
642 B
TypeScript

import "missing-native-js-functions";
import db from "./Database";
import { ProviderCache } from "lambert-db";
var Config: ProviderCache;
export default {
init: async function init(opts: DefaultOptions = DefaultOptions) {
Config = db.data.config({}).cache();
await Config.init();
await Config.set(opts.merge(Config.cache || {}));
},
getAll: function get() {
return <DefaultOptions>Config.get();
},
setAll: function set(val: any) {
return Config.set(val);
},
};
export interface DefaultOptions {
api: any;
gateway: any;
voice: any;
}
export const DefaultOptions: DefaultOptions = {
api: {},
gateway: {},
voice: {},
};