MCPcopy Index your code
hub / github.com/NginxProxyManager/nginx-proxy-manager / generateDbConfig

Function generateDbConfig

backend/db.js:6–33  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

4let instance = null;
5
6const generateDbConfig = () => {
7 if (!configHas("database")) {
8 throw new Error(
9 "Database config does not exist! Please read the instructions: https://nginxproxymanager.com/setup/",
10 );
11 }
12
13 const cfg = configGet("database");
14
15 if (cfg.engine === "knex-native") {
16 return cfg.knex;
17 }
18
19 return {
20 client: cfg.engine,
21 connection: {
22 host: cfg.host,
23 user: cfg.user,
24 password: cfg.password,
25 database: cfg.name,
26 port: cfg.port,
27 ...(cfg.ssl ? { ssl: cfg.ssl } : {})
28 },
29 migrations: {
30 tableName: "migrations",
31 },
32 };
33};
34
35const getInstance = () => {
36 if (!instance) {

Callers 1

getInstanceFunction · 0.85

Calls 2

configHasFunction · 0.90
configGetFunction · 0.90

Tested by

no test coverage detected