From 9c4c697c7ea7d86df925ffd5e497293e65a4f5d5 Mon Sep 17 00:00:00 2001 From: Sylvain Briat Date: Fri, 1 Mar 2024 14:43:45 +0100 Subject: [PATCH] add geocoder prioritizers and consolidators --- .env.dist | 6 +++++- src/config/geography.config.ts | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.env.dist b/.env.dist index 4a5719c..c6e62f2 100644 --- a/.env.dist +++ b/.env.dist @@ -76,9 +76,13 @@ GEOCODER_PROXIMITY=5 # => multiply the population by COEF / distance (in km) GEOCODER_POPULATION_PRIORITIZER_COEF=100 # a json array for main providers, see Geocoder service for detail about the providers -GEOCODER_PROVIDERS='[{"name":"provider1","type":"providerType","baseUrl":"http://localhost","geocodeEndpoint":"/path/to/geocode/endpoint","reverseEndpoint":"/path/to/reverse/endpoint","prioritization":"prioritizationString","countryRestriction":"countryRestrictionString"}]' +GEOCODER_PROVIDERS='[{"name":"provider1","type":"providerType","baseUrl":"http://localhost","countryRestriction":"countryRestrictionString"}]' # a json array for fallback providers GEOCODER_PROVIDERS_FALLBACK='[{"name":"provider1","type":"providerType","apiKey":"anApiKey"}]' +# a json array for prioritizers, see Geocoder service for detail about the prioritizers +GEOCODER_PRIOTITIZERS='[{"country": "countryName","addressTypes":[{"type":"addressType","prioritizers":[{"position":0,"name":"prioritizerName1"}]}]}]' +# a json array for consolidators, see Geocoder service for detail about the consolidators +GEOCODER_CONSOLIDATORS='[{"country":"countryName","addressTypes":[{"type":"addressType","name":"consolidatorName"}]}]' # PAGINATION # number of results per page diff --git a/src/config/geography.config.ts b/src/config/geography.config.ts index 5c37413..fdb8647 100644 --- a/src/config/geography.config.ts +++ b/src/config/geography.config.ts @@ -14,6 +14,8 @@ export interface GeographyConfig extends Config { geocoderPopulationPrioritizerCoef: number; geocoderProviders: object[]; geocoderProvidersFallback: object[]; + geocoderPrioritizers: object[]; + geocoderConsolidators: object[]; } export default registerAs('geography', () => ({ @@ -52,4 +54,10 @@ export default registerAs('geography', () => ({ geocoderProvidersFallback: process.env.GEOCODER_PROVIDERS_FALLBACK ? JSON.parse(process.env.GEOCODER_PROVIDERS_FALLBACK) : [], + geocoderPrioritizers: process.env.GEOCODER_PRIORITIZERS + ? JSON.parse(process.env.GEOCODER_PRIORITIZERS) + : [], + geocoderConsolidators: process.env.GEOCODER_CONSOLIDATORS + ? JSON.parse(process.env.GEOCODER_CONSOLIDATORS) + : [], }));