add geocoder prioritizers and consolidators

This commit is contained in:
Sylvain Briat 2024-03-01 14:43:45 +01:00
parent d75ac96384
commit 9c4c697c7e
2 changed files with 13 additions and 1 deletions

View File

@ -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

View File

@ -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)
: [],
}));