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

32 lines
879 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;
2021-04-15 11:29:53 +02:00
const authenticationType = config.authentication.type;
this.uiConfig = {
...config.ui,
2021-04-15 11:29:53 +02:00
authenticationType,
unleashUrl: config.unleashUrl,
baseUriPath: config.baseUriPath,
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;