123456789101112131415161718192021222324252627 |
- 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());
|