import type { AgentConfigOptions } from 'elastic-apm-node' ; import { getConfigurationFilePaths , getConfigFromFiles , applyConfigOverrides } from './utils' ; import { ApmConfiguration } from './config' ; let apmConfig ; param argv param rootDir param isDistributable export const loadConfiguration = ( argv , rootDir , isDistributable ) : ApmConfiguration => { const configPaths = getConfigurationFilePaths ( argv ) ; const rawConfiguration = getConfigFromFiles ( configPaths ) ; applyConfigOverrides ( rawConfiguration , argv ) ; apmConfig = new ApmConfiguration ( rootDir , rawConfiguration , isDistributable ) ; return apmConfig ; } ; export const getConfiguration = ( serviceName ) : AgentConfigOptions | undefined => { if ( apmConfig ) { return apmConfig . getConfig ( serviceName ) ; } return undefined ; } ;