From 5080feb96910dc8c016d35640986c90b50d1b461 Mon Sep 17 00:00:00 2001 From: Florian Lagouche Date: Tue, 18 May 2021 12:05:45 +0200 Subject: [PATCH] get postal cities countries from pelias-config --- src/postalCityMap.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/postalCityMap.js b/src/postalCityMap.js index c0d39af..6115ee3 100644 --- a/src/postalCityMap.js +++ b/src/postalCityMap.js @@ -49,16 +49,12 @@ const USA_ISO_CODES = ['USA','ASM','GUM','MNP','PRI','VIR']; please open a Pull Request. **/ -// select which ISO country code files are loaded. -const tables = { - 'ASM': loadTable('ASM'), // American Samoa - 'GUM': loadTable('GUM'), // Guam - 'MNP': loadTable('MNP'), // Northern Mariana Islands - 'PRI': loadTable('PRI'), // Puerto Rico - 'USA': loadTable('USA'), // Unites States of America - 'VIR': loadTable('VIR'), // United States Virgin Islands - 'NLD': loadTable('NLD'), // The Netherlands -}; +const configPostalCitiesCountries = _.get(config, 'imports.adminLookup.postalCitiesCountries', ['ASM','GUM','MNP','PRI','USA','VIR','NLD']); + +const tables = {}; +configPostalCitiesCountries.forEach(country => { + tables[country] = loadTable(country); +}); // load the file format in to memory function loadTable(cc){