mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
adding option to disable the info api
This commit is contained in:
@@ -3,6 +3,8 @@ const config = require('../../conf/config');
|
||||
const { getLastJobExecution, getLastProviderExecution, getTotalNumberOfListings } = require('../services/store');
|
||||
const PORT = 9998;
|
||||
const service = require('restana')();
|
||||
const enabled = config.infoApi == null ? false : config.infoApi;
|
||||
|
||||
service.use(bodyParser.json());
|
||||
|
||||
service.get('/', async (req, res) => {
|
||||
@@ -55,8 +57,12 @@ service.get('/ping', function (req, res) {
|
||||
res.send();
|
||||
});
|
||||
|
||||
service.start(PORT).then(() => {
|
||||
/* eslint-disable no-console */
|
||||
console.info(`Started API service on port ${PORT}`);
|
||||
/* eslint-enable no-console */
|
||||
});
|
||||
/* eslint-disable no-console */
|
||||
if (enabled) {
|
||||
service.start(PORT).then(() => {
|
||||
console.info(`Started API service on port ${PORT}`);
|
||||
});
|
||||
} else {
|
||||
console.info('Info Api is disabled.');
|
||||
}
|
||||
/* eslint-enable no-console */
|
||||
|
||||
Reference in New Issue
Block a user