import { ConfigObject } from '../models' ; import { logger } from './logger' ; import { PREDEFINED_ENV_PROPERTIES } from '../constants' ; import { parsePropertiesToObjects } from './documentUtils' ; returns { ConfigObject } export const getSpringApplicationJsonFromEnv = ( ) : ConfigObject => { let springApplicationJson = { } ; if ( process . env . APPLICATION_JSON !== undefined ) { springApplicationJson = JSON . parse ( process . env . APPLICATION_JSON ) ; logger . debug ( `Spring Application JSON from Env: ${ JSON . stringify ( springApplicationJson ) }` ) ; } return springApplicationJson ; } ; returns { ConfigObject } export const getPredefinedEnvProperties = ( ) : ConfigObject => { let customEnvProperties = { } ; Object . entries ( PREDEFINED_ENV_PROPERTIES ) . forEach ( ( [ customEnvVariable , propertyMapping ] ) => { if ( process . env [ customEnvVariable ] !== undefined ) { customEnvProperties [ propertyMapping ] = process . env [ customEnvVariable ] ; } } ) ; customEnvProperties = parsePropertiesToObjects ( customEnvProperties ) ; logger . debug ( `Custom Properties from Env: ${ JSON . stringify ( customEnvProperties ) }` ) ; return customEnvProperties ; } ;