Merge branch 'geocoderConfig' into 'main'

add geocoder configuration

See merge request v3/service/configuration!37
This commit is contained in:
Sylvain Briat 2024-01-04 14:43:11 +00:00
commit b88ac36b30
4 changed files with 63 additions and 3 deletions

View File

@ -56,6 +56,26 @@ MAX_DETOUR_DURATION_RATIO=0.3
GEOROUTER_TYPE=graphhopper
GEOROUTER_URL=http://localhost:8989
# GEOCODER
# default language
GEOCODER_LANG=fr
# minimal score to consider a result as valid
GEOCODEr_MIN_CONFIDENCE=0.5
# max number of results per provider (input results)
GEOCODER_MAX_RESULTS_PER_PROVIDER=5
# max number of results per address type (output results)
GEOCODER_MAX_RESULTS_PER_TYPE=5
# sanitize results ?
GEOCODER_SANITIZE=true
# consolidate results ?
GEOCODER_CONSOLIDATE=true
# max distance in km between 2 points to consider a duplicate
GEOCODER_PROXIMITY=5
# population vs distance prioritizer coef
# "boost" population weight for results with a short distance
# => multiply the population by COEF / distance (in km)
GEOCODDER_POPULATION_PRIORITIZER_COEF=100
# PAGINATION
# number of results per page
PER_PAGE=10

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@mobicoop/configuration",
"version": "2.5.3",
"version": "2.6.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@mobicoop/configuration",
"version": "2.5.3",
"version": "2.6.0",
"license": "AGPL",
"dependencies": {
"@grpc/grpc-js": "^1.9.9",

View File

@ -1,6 +1,6 @@
{
"name": "@mobicoop/configuration",
"version": "2.5.3",
"version": "2.6.0",
"description": "Mobicoop V3 Configuration Service",
"author": "sbriat",
"private": true,

View File

@ -4,9 +4,49 @@ import { Config } from './config';
export interface GeographyConfig extends Config {
georouterType: string;
georouterUrl: string;
geocoderLang: string;
geocoderMinConfidence: number;
geocoderMaxResultsPerProvider: number;
geocoderMaxResultsPerType: number;
geocoderSanitize: boolean;
geocoderConsolidate: boolean;
geocoderProximity: number;
geocoderPopulationPrioritizerCoef: number;
geocoderProviders: string[];
geocoderProvidersFallback: string[];
}
export default registerAs('geography', () => ({
georouterType: process.env.GEOROUTER_TYPE ?? 'graphhopper',
georouterUrl: process.env.GEOROUTER_URL ?? 'http://localhost:8989',
geocoderLang: process.env.GEOCODER_LANG ?? 'fr',
geocoderMinConfidence: process.env.GEOCODER_MIN_CONFIDENCE
? parseFloat(process.env.GEOCODER_MIN_CONFIDENCE)
: 0.5,
geocoderMaxResultsPerProvider: process.env.GEOCODER_MAX_RESULTS_PER_PROVIDER
? parseInt(process.env.GEOCODER_MAX_RESULTS_PER_PROVIDER)
: 5,
geocoderMaxResultsPerType: process.env.GEOCODER_MAX_RESULTS_PER_TYPE
? parseInt(process.env.GEOCODER_MAX_RESULTS_PER_TYPE)
: 5,
geocoderSanitize: process.env.GEOCODER_SANITIZE
? process.env.GEOCODER_SANITIZE === 'false'
? false
: true
: true,
geocoderConsolidate: process.env.GEOCODER_CONSOLIDATE
? process.env.GEOCODER_CONSOLIDATE === 'false'
? false
: true
: true,
geocoderProximity: process.env.GEOCODER_PROXIMITY
? parseInt(process.env.GEOCODER_PROXIMITY)
: 5,
geocoderPopulationPrioritizerCoef: process.env
.GEOCODER_POPULATION_PRIORITIZER_COEF
? parseInt(process.env.GEOCODER_POPULATION_PRIORITIZER_COEF)
: 100,
geocoderProviders:
process.env.GEOCODER_PROVIDERS ?? 'ADDOK,PELIAS_SEARCH,PELIAS_AUTOCOMPLETE',
geocoderProvidersFallback: process.env.GEOCODER_PROVIDERS_FALLBACK ?? 'GMAPS',
}));