import { callEnterpriseSearchConfigAPI } from '../../lib/enterprise_search_config_api' ; import { RouteDependencies } from '../../plugin' ; export function registerConfigDataRoute ( { router , config , log } ) { router . get ( { path : '/internal/enterprise_search/config_data' , validate : false , } , async ( context , request , response ) => { const data = await callEnterpriseSearchConfigAPI ( { request , config , log } ) ; if ( ! Object . keys ( data ) . length ) { return response . customError ( { statusCode : 502 , body : 'Error fetching data from Enterprise Search' , } ) ; } else { return response . ok ( { body : data , headers : { 'content-type' : 'application/json' } , } ) ; } } ) ; }