mirror of
https://github.com/NginxProxyManager/nginx-proxy-manager.git
synced 2025-09-14 10:52:34 +00:00
Convert backend to ESM
- About 5 years overdue - Remove eslint, use bomejs instead
This commit is contained in:
@@ -1,27 +1,32 @@
|
||||
const config = require('./lib/config');
|
||||
import knex from "knex";
|
||||
import {configGet, configHas} from "./lib/config.js";
|
||||
|
||||
if (!config.has('database')) {
|
||||
throw new Error('Database config does not exist! Please read the instructions: https://nginxproxymanager.com/setup/');
|
||||
}
|
||||
const generateDbConfig = () => {
|
||||
if (!configHas("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') {
|
||||
const cfg = configGet("database");
|
||||
|
||||
if (cfg.engine === "knex-native") {
|
||||
return cfg.knex;
|
||||
}
|
||||
|
||||
return {
|
||||
client: cfg.engine,
|
||||
client: cfg.engine,
|
||||
connection: {
|
||||
host: cfg.host,
|
||||
user: cfg.user,
|
||||
host: cfg.host,
|
||||
user: cfg.user,
|
||||
password: cfg.password,
|
||||
database: cfg.name,
|
||||
port: cfg.port
|
||||
port: cfg.port,
|
||||
},
|
||||
migrations: {
|
||||
tableName: 'migrations'
|
||||
}
|
||||
tableName: "migrations",
|
||||
},
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = require('knex')(generateDbConfig());
|
||||
export default knex(generateDbConfig());
|
||||
|
Reference in New Issue
Block a user