mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-11 05:02:37 +01:00
🐛 fix config: don't use mongodb change streams
This commit is contained in:
parent
59ff8c5194
commit
577bfd6f37
@ -4,15 +4,15 @@ import db, { MongooseCache } from "./Database";
|
|||||||
import { Snowflake } from "./Snowflake";
|
import { Snowflake } from "./Snowflake";
|
||||||
import crypto from "crypto";
|
import crypto from "crypto";
|
||||||
|
|
||||||
var Config = new MongooseCache(db.collection("config"), [], { onlyEvents: false, array: false });
|
var config: any;
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
init: async function init(defaultOpts: any = DefaultOptions) {
|
init: async function init(defaultOpts: any = DefaultOptions) {
|
||||||
await Config.init();
|
config = await db.collection("config").findOne({});
|
||||||
return this.set((Config.data || {}).merge(defaultOpts));
|
return this.set((config || {}).merge(defaultOpts));
|
||||||
},
|
},
|
||||||
get: function get() {
|
get: function get() {
|
||||||
return <DefaultOptions>Config.data;
|
return config as DefaultOptions;
|
||||||
},
|
},
|
||||||
set: function set(val: any) {
|
set: function set(val: any) {
|
||||||
return db.collection("config").updateOne({}, { $set: val }, { upsert: true });
|
return db.collection("config").updateOne({}, { $set: val }, { upsert: true });
|
||||||
|
Loading…
Reference in New Issue
Block a user