Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/config/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ require("env2")(".env");
const Sequelize = require("sequelize");

class Database {

constructor() {
if (Database._instance) {
throw new Error(
Expand All @@ -28,13 +28,14 @@ class Database {
} catch (error) {
console.error("Unable to connect to the database:", error);
}
}

Database._instance = this;
}

static getInstance() {
return Database._instance;
static getInstance() {
if (!this._instance){
this._instance = new Database();
}
return this._instance;
}

parseSSLEnvVar() {
this.sequelize_ssl = process.env.SEQUELIZE_SSL.toLowerCase();
Expand Down