Fix DB path loading

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2023-01-20 15:25:06 -08:00
parent 1a48f0eae6
commit bdc5f8f21c
2 changed files with 19 additions and 2 deletions

View File

@ -19,8 +19,16 @@ const fs = require('fs'),
config = require('config');
function init() {
const dbConfig = {...config.get("db.photos")};
let configPath = process.env.NODE_CONFIG_DIR;
if (configPath) {
configPath = configPath.replace(/config/, '');
} else {
configPath = './'
}
dbConfig.host = `${configPath}${dbConfig.host}`;
const db = {
sequelize: new Sequelize(config.get("db.photos")),
sequelize: new Sequelize(dbConfig),
Sequelize: Sequelize
};

View File

@ -17,8 +17,17 @@ const Sequelize = require('sequelize'),
config = require('config');
function init() {
const dbConfig = {...config.get("db.users")};
let configPath = process.env.NODE_CONFIG_DIR;
if (configPath) {
configPath = configPath.replace(/config/, '');
} else {
configPath = './'
}
dbConfig.host = `${configPath}${dbConfig.host}`;
const db = {
sequelize: new Sequelize(config.get("db.users")),
sequelize: new Sequelize(dbConfig),
Sequelize: Sequelize
};