diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-02-13 14:18:19 +0100 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-02-13 14:18:19 +0100 |
commit | 54542ef34fd9ded5c89df8fa7c90e0099196dd00 (patch) | |
tree | 606bdbe85d6e10f2e67c937d168a298dc0fe2ce5 | |
parent | :zap: Config and database update (diff) | |
download | server-54542ef34fd9ded5c89df8fa7c90e0099196dd00.tar.xz |
:sparkles: Config init takes default opts
-rw-r--r-- | dist/util/Config.d.ts | 2 | ||||
-rw-r--r-- | dist/util/Config.js | 4 | ||||
-rw-r--r-- | dist/util/Config.js.map | 2 | ||||
-rw-r--r-- | src/util/Config.ts | 4 |
4 files changed, 6 insertions, 6 deletions
diff --git a/dist/util/Config.d.ts b/dist/util/Config.d.ts index 1c6021c9..efab99c2 100644 --- a/dist/util/Config.d.ts +++ b/dist/util/Config.d.ts @@ -2,7 +2,7 @@ import { Schema, Document } from "mongoose"; import "missing-native-js-functions"; declare const _default: { - init: () => Promise<import("mongodb").UpdateWriteOpResult>; + init: (defaultOpts?: any) => Promise<import("mongodb").UpdateWriteOpResult>; getAll: () => DefaultOptions; setAll: (val: any) => Promise<import("mongodb").UpdateWriteOpResult>; }; diff --git a/dist/util/Config.js b/dist/util/Config.js index bde6c735..6c19c436 100644 --- a/dist/util/Config.js +++ b/dist/util/Config.js @@ -25,9 +25,9 @@ require("missing-native-js-functions"); const Database_1 = __importStar(require("./Database")); var Config = new Database_1.MongooseCache(Database_1.default.collection("config"), [], { onlyEvents: false }); exports.default = { - init: async function init() { + init: async function init(defaultOpts = exports.DefaultOptions) { await Config.init(); - return this.setAll(Config.data.merge(exports.DefaultOptions)); + return this.setAll(Config.data.merge(defaultOpts)); }, getAll: function get() { return Config.data; diff --git a/dist/util/Config.js.map b/dist/util/Config.js.map index 90489e99..5ba08276 100644 --- a/dist/util/Config.js.map +++ b/dist/util/Config.js.map @@ -1 +1 @@ -{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/util/Config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA0D;AAC1D,uCAAqC;AACrC,uDAA+C;AAE/C,IAAI,MAAM,GAAG,IAAI,wBAAa,CAAC,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;AAEnF,kBAAe;IACd,IAAI,EAAE,KAAK,UAAU,IAAI;QACxB,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,sBAAc,CAAC,CAAC,CAAC;IACvD,CAAC;IACD,MAAM,EAAE,SAAS,GAAG;QACnB,OAAuB,MAAM,CAAC,IAAI,CAAC;IACpC,CAAC;IACD,MAAM,EAAE,SAAS,GAAG,CAAC,GAAQ;QAC5B,OAAO,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IAC7D,CAAC;CACD,CAAC;AAEW,QAAA,cAAc,GAAG;IAC7B,GAAG,EAAE,EAAE;IACP,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,EAAE;CACT,CAAC;AAQW,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,MAAM;CACb,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,gBAAK,CAAiB,QAAQ,EAAE,oBAAY,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file +{"version":3,"file":"Config.js","sourceRoot":"","sources":["../../src/util/Config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,uCAA0D;AAC1D,uCAAqC;AACrC,uDAA+C;AAE/C,IAAI,MAAM,GAAG,IAAI,wBAAa,CAAC,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC,CAAC;AAEnF,kBAAe;IACd,IAAI,EAAE,KAAK,UAAU,IAAI,CAAC,cAAmB,sBAAc;QAC1D,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;QACpB,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,EAAE,SAAS,GAAG;QACnB,OAAuB,MAAM,CAAC,IAAI,CAAC;IACpC,CAAC;IACD,MAAM,EAAE,SAAS,GAAG,CAAC,GAAQ;QAC5B,OAAO,kBAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IAC7D,CAAC;CACD,CAAC;AAEW,QAAA,cAAc,GAAG;IAC7B,GAAG,EAAE,EAAE;IACP,OAAO,EAAE,EAAE;IACX,KAAK,EAAE,EAAE;CACT,CAAC;AAQW,QAAA,YAAY,GAAG,IAAI,iBAAM,CAAC;IACtC,GAAG,EAAE,MAAM;IACX,OAAO,EAAE,MAAM;IACf,KAAK,EAAE,MAAM;CACb,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,gBAAK,CAAiB,QAAQ,EAAE,oBAAY,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/src/util/Config.ts b/src/util/Config.ts index ad70d37a..83370df4 100644 --- a/src/util/Config.ts +++ b/src/util/Config.ts @@ -5,9 +5,9 @@ import db, { MongooseCache } from "./Database"; var Config = new MongooseCache(db.collection("config"), [], { onlyEvents: false }); export default { - init: async function init() { + init: async function init(defaultOpts: any = DefaultOptions) { await Config.init(); - return this.setAll(Config.data.merge(DefaultOptions)); + return this.setAll(Config.data.merge(defaultOpts)); }, getAll: function get() { return <DefaultOptions>Config.data; |