2020-04-08 16:27:34 +02:00
|
|
|
class Provider {
|
|
|
|
|
2020-04-16 14:37:04 +02:00
|
|
|
constructor(manager, opts) {
|
2020-04-08 18:08:46 +02:00
|
|
|
|
2020-04-16 14:37:04 +02:00
|
|
|
if(!opts.config) throw new Error('No config file provided!');
|
|
|
|
this.config = opts.config[opts.name];
|
|
|
|
if(this.config && (!this.config.database || !this.config.host)) throw new Error('Invalid config file provided!' + JSON.stringify(this.config));
|
2020-04-08 18:08:46 +02:00
|
|
|
|
|
|
|
this.manager = manager;
|
|
|
|
|
2020-04-16 14:37:04 +02:00
|
|
|
this.name = opts.name;
|
|
|
|
|
|
|
|
this.connection = null;
|
|
|
|
this.db = null;
|
|
|
|
|
|
|
|
this._initialized = false;
|
2020-04-08 18:08:46 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2020-04-08 16:27:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Provider;
|