import { Container } from 'typedi' ; import get from 'lodash.get' ; import { Application } from '../interfaces/Application' ; export function InjectConfig ( key ? ) { return function ( object , propertyName , index ? ) { Container . registerHandler ( { object , propertyName , index , value : ( ) => { const app = Container . get < Application > ( 'TIE_APP' ) ; const config = app . config ; if ( ! key ) return config ; return get ( config , key ) ; } , } ) ; } ; }