import * as CloudConfigClient from 'nice-cloud-config-client' ; import { ConfigClientOptions , ConfigObject } from '../models' ; import { injectable } from 'inversify' ; import { parsePropertiesToObjects } from '../utils' ; @ injectable ( ) export class SpringCloudConfigGatewayImpl { param { ConfigClientOptions } configClientOptions returns { Promise < ConfigObject > } public async getConfigFromServer ( configClientOptions ) { let cloudConfig = { } ; const cloudConfigProperties = await CloudConfigClient . load ( configClientOptions , undefined ) ; if ( cloudConfigProperties ) { cloudConfigProperties . forEach ( function ( key , value ) { cloudConfig [ key ] = value ; } , false ) ; cloudConfig = parsePropertiesToObjects ( cloudConfig ) ; } return cloudConfig ; } }