mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
2a07445005
- No longer use config npm package - Prefer config from env vars, though still has support for config file - No longer writes a config file for database config - Writes keys to a new file in /data folder - Removes a lot of cruft and improves config understanding
28 lines
604 B
JavaScript
28 lines
604 B
JavaScript
const config = require('./lib/config');
|
|
|
|
if (!config.has('database')) {
|
|
throw new Error('Database config does not exist! Please read the instructions: https://nginxproxymanager.com/setup/');
|
|
}
|
|
|
|
function generateDbConfig() {
|
|
const cfg = config.get('database');
|
|
if (cfg.engine === 'knex-native') {
|
|
return cfg.knex;
|
|
}
|
|
return {
|
|
client: cfg.engine,
|
|
connection: {
|
|
host: cfg.host,
|
|
user: cfg.user,
|
|
password: cfg.password,
|
|
database: cfg.name,
|
|
port: cfg.port
|
|
},
|
|
migrations: {
|
|
tableName: 'migrations'
|
|
}
|
|
};
|
|
}
|
|
|
|
module.exports = require('knex')(generateDbConfig());
|