db.js 651 B

12345678910111213141516171819202122232425
  1. const config = require('config');
  2. if (!config.has('database')) {
  3. throw new Error('Database config does not exist! Please read the instructions: https://github.com/jc21/nginx-proxy-manager/blob/master/doc/INSTALL.md');
  4. }
  5. let data = {
  6. client: config.database.engine,
  7. connection: {
  8. host: config.database.host,
  9. user: config.database.user,
  10. password: config.database.password,
  11. database: config.database.name,
  12. port: config.database.port
  13. },
  14. migrations: {
  15. tableName: 'migrations'
  16. }
  17. };
  18. if (typeof config.database.version !== 'undefined') {
  19. data.version = config.database.version;
  20. }
  21. module.exports = require('knex')(data);