1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-31 00:16:47 +01:00
unleash.unleash/src/lib/routes/admin-api/config.js

28 lines
696 B
JavaScript
Raw Normal View History

2019-03-12 10:46:08 +01:00
'use strict';
const Controller = require('../controller');
class ConfigController extends Controller {
constructor(config, { versionService }) {
2019-03-12 10:46:08 +01:00
super(config);
this.versionService = versionService;
this.uiConfig = {
...config.ui,
version: config.version,
};
2019-03-12 10:46:08 +01:00
this.get('/', this.getUIConfig);
}
async getUIConfig(req, res) {
const config = this.uiConfig;
if (this.versionService) {
const versionInfo = this.versionService.getVersionInfo();
res.json({ ...config, versionInfo });
} else {
res.json(config);
}
2019-03-12 10:46:08 +01:00
}
}
module.exports = ConfigController;