mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-25 19:52:36 +01:00
Config
This commit is contained in:
parent
9b3209efd5
commit
d4a89cae8a
30
src/Config.ts
Normal file
30
src/Config.ts
Normal file
@ -0,0 +1,30 @@
|
||||
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: {},
|
||||
};
|
3
src/Constants.ts
Normal file
3
src/Constants.ts
Normal file
@ -0,0 +1,3 @@
|
||||
import { VerifyOptions } from "jsonwebtoken";
|
||||
|
||||
export const JWTOptions: VerifyOptions = { algorithms: ["HS256"] };
|
Loading…
Reference in New Issue
Block a user