You've already forked nginx-proxy-manager
							
							
				mirror of
				https://github.com/NginxProxyManager/nginx-proxy-manager.git
				synced 2025-10-30 18:05:34 +03:00 
			
		
		
		
	- 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());
 |