import { getUnusedConfigKeys } from './get_unused_config_keys' ; import { ConfigService } from '../../config' ; import { CriticalError } from '../../errors' ; import { LegacyServiceSetupConfig } from '../types' ; export async function ensureValidConfiguration ( configService , { legacyConfig , settings } ) { const unusedConfigKeys = await getUnusedConfigKeys ( { coreHandledConfigPaths : await configService . getUsedPaths ( ) , settings , legacyConfig , } ) ; if ( unusedConfigKeys . length > 0 ) { const message = `Unknown configuration key(s): ${ unusedConfigKeys . map ( ( key ) => `"${ key }"` ) . join ( ', ' ) }. Check for spelling errors and ensure that expected plugins are installed.` ; throw new InvalidConfigurationError ( message ) ; } } class InvalidConfigurationError extends CriticalError { constructor ( message ) { super ( message , 'InvalidConfig' , 64 ) ; Object . setPrototypeOf ( this , InvalidConfigurationError . prototype ) ; } }