mirror of
https://github.com/jc21/nginx-proxy-manager.git
synced 2024-08-30 18:22:48 +00:00
2a07445005
- 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
50 lines
1.2 KiB
JavaScript
50 lines
1.2 KiB
JavaScript
#!/usr/bin/env node
|
|
|
|
const fs = require('fs');
|
|
const logger = require('./logger').global;
|
|
|
|
async function appStart () {
|
|
const migrate = require('./migrate');
|
|
const setup = require('./setup');
|
|
const app = require('./app');
|
|
const apiValidator = require('./lib/validator/api');
|
|
const internalCertificate = require('./internal/certificate');
|
|
const internalIpRanges = require('./internal/ip_ranges');
|
|
|
|
return migrate.latest()
|
|
.then(setup)
|
|
.then(() => {
|
|
return apiValidator.loadSchemas;
|
|
})
|
|
.then(internalIpRanges.fetch)
|
|
.then(() => {
|
|
|
|
internalCertificate.initTimer();
|
|
internalIpRanges.initTimer();
|
|
|
|
const server = app.listen(3000, () => {
|
|
logger.info('Backend PID ' + process.pid + ' listening on port 3000 ...');
|
|
|
|
process.on('SIGTERM', () => {
|
|
logger.info('PID ' + process.pid + ' received SIGTERM');
|
|
server.close(() => {
|
|
logger.info('Stopping.');
|
|
process.exit(0);
|
|
});
|
|
});
|
|
});
|
|
})
|
|
.catch((err) => {
|
|
logger.error(err.message);
|
|
setTimeout(appStart, 1000);
|
|
});
|
|
}
|
|
|
|
try {
|
|
appStart();
|
|
} catch (err) {
|
|
logger.error(err.message, err);
|
|
process.exit(1);
|
|
}
|
|
|