Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 59x 59x 59x 59x 141x 141x 141x 141x 141x 141x 3x 3x 3x 3x 3x 59x | import { Request, Response } from 'express'; import { IUnleashServices } from '../../types/services'; import { IAuthType, IUnleashConfig } from '../../types/option'; import version from '../../util/version'; import Controller from '../controller'; import VersionService from '../../services/version-service'; import SettingService from '../../services/setting-service'; import { simpleAuthKey, SimpleAuthSettings, } from '../../types/settings/simple-auth-settings'; class ConfigController extends Controller { private versionService: VersionService; private settingService: SettingService; private uiConfig: any; constructor( config: IUnleashConfig, { versionService, settingService, }: Pick<IUnleashServices, 'versionService' | 'settingService'>, ) { super(config); this.versionService = versionService; this.settingService = settingService; const authenticationType = config.authentication && config.authentication.type; this.uiConfig = { ...config.ui, authenticationType, unleashUrl: config.server.unleashUrl, baseUriPath: config.server.baseUriPath, version, }; this.get('/', this.getUIConfig); } async getUIConfig(req: Request, res: Response): Promise<void> { const config = this.uiConfig; const simpleAuthSettings = await this.settingService.get<SimpleAuthSettings>(simpleAuthKey); const versionInfo = this.versionService.getVersionInfo(); const disablePasswordAuth = simpleAuthSettings?.disabled || this.config.authentication.type == IAuthType.NONE; res.json({ ...config, versionInfo, disablePasswordAuth }); } } export default ConfigController; |