import { EnvironmentEnum } from '../config' ; import { ConfigSetType , ConfigEnvType } from '../model/type/config.type' ; import { logger } from '../util' ; import { AbstractService } from './Service.abstract' ; const defaultEnv = { NODE_ENV : EnvironmentEnum . production , BDK_NETWORK_NAME : 'bdk-network' , BDK_ORG_TYPE : 'peer' , BDK_ORG_NAME : 'Org1' , BDK_ORG_DOMAIN : 'org1.example.com' , BDK_HOSTNAME : 'peer0' , LOGGER_SILLY : false , } ; export default class Config extends AbstractService { description returns public init ( args = defaultEnv ) { logger . debug ( 'Config init' ) ; const initEnv = Object . assign ( { } , defaultEnv , args ) ; this . bdkFile . createEnv ( initEnv ) ; } description public set ( args ) { logger . debug ( `Config set: set ${ args . key } to ${ args . value }` ) ; const envObj = this . bdkFile . getEnv ( ) ; this . bdkFile . createEnv ( Object . assign ( { } , envObj , { [ args . key ] : args . value } ) ) ; } description public ls ( ) { logger . debug ( 'Config ls' ) ; return this . bdkFile . getEnv ( ) ; } }