Merge branch 'georouterConfig' into 'main'

Georouter config

See merge request v3/service/configuration!30
This commit is contained in:
Sylvain Briat 2023-10-31 14:31:14 +00:00
commit c0122e395a
7 changed files with 100 additions and 70 deletions

View File

@ -48,6 +48,10 @@ MARGIN_DURATION=900
MAX_DETOUR_DISTANCE_RATIO=0.3
MAX_DETOUR_DURATION_RATIO=0.3
# GEOROUTER
GEOROUTER_TYPE=graphhopper
GEOROUTER_URL=http://51.210.249.175:8989
# PAGINATION
# number of results per page
PER_PAGE=10

124
package-lock.json generated
View File

@ -1,17 +1,17 @@
{
"name": "@mobicoop/configuration",
"version": "2.3.0",
"version": "2.4.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@mobicoop/configuration",
"version": "2.3.0",
"version": "2.4.0",
"license": "AGPL",
"dependencies": {
"@grpc/grpc-js": "^1.9.8",
"@grpc/grpc-js": "^1.9.9",
"@grpc/proto-loader": "^0.7.10",
"@mobicoop/configuration-module": "^6.1.0",
"@mobicoop/configuration-module": "^7.2.1",
"@mobicoop/ddd-library": "^2.1.1",
"@mobicoop/health-module": "^2.3.1",
"@mobicoop/message-broker-module": "^2.1.1",
@ -33,11 +33,11 @@
"@nestjs/schematics": "^10.0.3",
"@nestjs/testing": "^10.2.7",
"@types/express": "^4.17.20",
"@types/jest": "29.5.6",
"@types/node": "^20.8.9",
"@types/jest": "29.5.7",
"@types/node": "^20.8.10",
"@types/supertest": "^2.0.15",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"dotenv-cli": "^7.3.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",
@ -1031,9 +1031,9 @@
]
},
"node_modules/@grpc/grpc-js": {
"version": "1.9.8",
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.8.tgz",
"integrity": "sha512-FFPzDS333Vw8hvf+1FaEsaCYVPBdNdUCw7zArTiF7+6gOzln967b4GBCBekKGqoKEgna8d3Ayxv8t+IvazXG3g==",
"version": "1.9.9",
"resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.9.9.tgz",
"integrity": "sha512-vQ1qwi/Kiyprt+uhb1+rHMpyk4CVRMTGNUGGPRGS7pLNfWkdCHrGEnT6T3/JyC2VZgoOX/X1KwdoU0WYQAeYcQ==",
"dependencies": {
"@grpc/proto-loader": "^0.7.8",
"@types/node": ">=12.12.47"
@ -1668,9 +1668,9 @@
}
},
"node_modules/@mobicoop/configuration-module": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/@mobicoop/configuration-module/-/configuration-module-6.1.0.tgz",
"integrity": "sha512-ar4hx+oB+RtgAj0SLg0/xgxHA7r/LnUz9BzXUlEX4va0AQwSPdFgTJhku6flMW4U0sJdtGEay3740BnqGfMtCw==",
"version": "7.2.1",
"resolved": "https://registry.npmjs.org/@mobicoop/configuration-module/-/configuration-module-7.2.1.tgz",
"integrity": "sha512-PGY80+uN33yKSxvqcR2CPlAbhEY67xYfVDqkphIoqGb5qAwioVZH5a8InJw4Zg0Q5bx0ZQG5pcK0jha7kSxqzQ==",
"dependencies": {
"@songkeys/nestjs-redis": "^10.0.0",
"ioredis": "^5.3.2"
@ -2585,9 +2585,9 @@
}
},
"node_modules/@types/jest": {
"version": "29.5.6",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.6.tgz",
"integrity": "sha512-/t9NnzkOpXb4Nfvg17ieHE6EeSjDS2SGSpNYfoLbUAeL/EOueU/RSdOWFpfQTXBEM7BguYW1XQ0EbM+6RlIh6w==",
"version": "29.5.7",
"resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.7.tgz",
"integrity": "sha512-HLyetab6KVPSiF+7pFcUyMeLsx25LDNDemw9mGsJBkai/oouwrjTycocSDYopMEwFhN2Y4s9oPyOCZNofgSt2g==",
"dev": true,
"dependencies": {
"expect": "^29.0.0",
@ -2607,9 +2607,9 @@
"dev": true
},
"node_modules/@types/node": {
"version": "20.8.9",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.9.tgz",
"integrity": "sha512-UzykFsT3FhHb1h7yD4CA4YhBHq545JC0YnEz41xkipN88eKQtL6rSgocL5tbAP6Ola9Izm/Aw4Ora8He4x0BHg==",
"version": "20.8.10",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.8.10.tgz",
"integrity": "sha512-TlgT8JntpcbmKUFzjhsyhGfP2fsiz1Mv56im6enJ905xG1DAYesxJaeSbGqQmAw8OWPdhyJGhGSQGKRNJ45u9w==",
"dependencies": {
"undici-types": "~5.26.4"
}
@ -2699,16 +2699,16 @@
"dev": true
},
"node_modules/@typescript-eslint/eslint-plugin": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.0.tgz",
"integrity": "sha512-lgX7F0azQwRPB7t7WAyeHWVfW1YJ9NIgd9mvGhfQpRY56X6AVf8mwM8Wol+0z4liE7XX3QOt8MN1rUKCfSjRIA==",
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-6.9.1.tgz",
"integrity": "sha512-w0tiiRc9I4S5XSXXrMHOWgHgxbrBn1Ro+PmiYhSg2ZVdxrAJtQgzU5o2m1BfP6UOn7Vxcc6152vFjQfmZR4xEg==",
"dev": true,
"dependencies": {
"@eslint-community/regexpp": "^4.5.1",
"@typescript-eslint/scope-manager": "6.9.0",
"@typescript-eslint/type-utils": "6.9.0",
"@typescript-eslint/utils": "6.9.0",
"@typescript-eslint/visitor-keys": "6.9.0",
"@typescript-eslint/scope-manager": "6.9.1",
"@typescript-eslint/type-utils": "6.9.1",
"@typescript-eslint/utils": "6.9.1",
"@typescript-eslint/visitor-keys": "6.9.1",
"debug": "^4.3.4",
"graphemer": "^1.4.0",
"ignore": "^5.2.4",
@ -2734,15 +2734,15 @@
}
},
"node_modules/@typescript-eslint/parser": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.0.tgz",
"integrity": "sha512-GZmjMh4AJ/5gaH4XF2eXA8tMnHWP+Pm1mjQR2QN4Iz+j/zO04b9TOvJYOX2sCNIQHtRStKTxRY1FX7LhpJT4Gw==",
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-6.9.1.tgz",
"integrity": "sha512-C7AK2wn43GSaCUZ9do6Ksgi2g3mwFkMO3Cis96kzmgudoVaKyt62yNzJOktP0HDLb/iO2O0n2lBOzJgr6Q/cyg==",
"dev": true,
"dependencies": {
"@typescript-eslint/scope-manager": "6.9.0",
"@typescript-eslint/types": "6.9.0",
"@typescript-eslint/typescript-estree": "6.9.0",
"@typescript-eslint/visitor-keys": "6.9.0",
"@typescript-eslint/scope-manager": "6.9.1",
"@typescript-eslint/types": "6.9.1",
"@typescript-eslint/typescript-estree": "6.9.1",
"@typescript-eslint/visitor-keys": "6.9.1",
"debug": "^4.3.4"
},
"engines": {
@ -2762,13 +2762,13 @@
}
},
"node_modules/@typescript-eslint/scope-manager": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.0.tgz",
"integrity": "sha512-1R8A9Mc39n4pCCz9o79qRO31HGNDvC7UhPhv26TovDsWPBDx+Sg3rOZdCELIA3ZmNoWAuxaMOT7aWtGRSYkQxw==",
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-6.9.1.tgz",
"integrity": "sha512-38IxvKB6NAne3g/+MyXMs2Cda/Sz+CEpmm+KLGEM8hx/CvnSRuw51i8ukfwB/B/sESdeTGet1NH1Wj7I0YXswg==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.9.0",
"@typescript-eslint/visitor-keys": "6.9.0"
"@typescript-eslint/types": "6.9.1",
"@typescript-eslint/visitor-keys": "6.9.1"
},
"engines": {
"node": "^16.0.0 || >=18.0.0"
@ -2779,13 +2779,13 @@
}
},
"node_modules/@typescript-eslint/type-utils": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.0.tgz",
"integrity": "sha512-XXeahmfbpuhVbhSOROIzJ+b13krFmgtc4GlEuu1WBT+RpyGPIA4Y/eGnXzjbDj5gZLzpAXO/sj+IF/x2GtTMjQ==",
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-6.9.1.tgz",
"integrity": "sha512-eh2oHaUKCK58qIeYp19F5V5TbpM52680sB4zNSz29VBQPTWIlE/hCj5P5B1AChxECe/fmZlspAWFuRniep1Skg==",
"dev": true,
"dependencies": {
"@typescript-eslint/typescript-estree": "6.9.0",
"@typescript-eslint/utils": "6.9.0",
"@typescript-eslint/typescript-estree": "6.9.1",
"@typescript-eslint/utils": "6.9.1",
"debug": "^4.3.4",
"ts-api-utils": "^1.0.1"
},
@ -2806,9 +2806,9 @@
}
},
"node_modules/@typescript-eslint/types": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.0.tgz",
"integrity": "sha512-+KB0lbkpxBkBSiVCuQvduqMJy+I1FyDbdwSpM3IoBS7APl4Bu15lStPjgBIdykdRqQNYqYNMa8Kuidax6phaEw==",
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-6.9.1.tgz",
"integrity": "sha512-BUGslGOb14zUHOUmDB2FfT6SI1CcZEJYfF3qFwBeUrU6srJfzANonwRYHDpLBuzbq3HaoF2XL2hcr01c8f8OaQ==",
"dev": true,
"engines": {
"node": "^16.0.0 || >=18.0.0"
@ -2819,13 +2819,13 @@
}
},
"node_modules/@typescript-eslint/typescript-estree": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.0.tgz",
"integrity": "sha512-NJM2BnJFZBEAbCfBP00zONKXvMqihZCrmwCaik0UhLr0vAgb6oguXxLX1k00oQyD+vZZ+CJn3kocvv2yxm4awQ==",
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-6.9.1.tgz",
"integrity": "sha512-U+mUylTHfcqeO7mLWVQ5W/tMLXqVpRv61wm9ZtfE5egz7gtnmqVIw9ryh0mgIlkKk9rZLY3UHygsBSdB9/ftyw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.9.0",
"@typescript-eslint/visitor-keys": "6.9.0",
"@typescript-eslint/types": "6.9.1",
"@typescript-eslint/visitor-keys": "6.9.1",
"debug": "^4.3.4",
"globby": "^11.1.0",
"is-glob": "^4.0.3",
@ -2846,17 +2846,17 @@
}
},
"node_modules/@typescript-eslint/utils": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.0.tgz",
"integrity": "sha512-5Wf+Jsqya7WcCO8me504FBigeQKVLAMPmUzYgDbWchINNh1KJbxCgVya3EQ2MjvJMVeXl3pofRmprqX6mfQkjQ==",
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-6.9.1.tgz",
"integrity": "sha512-L1T0A5nFdQrMVunpZgzqPL6y2wVreSyHhKGZryS6jrEN7bD9NplVAyMryUhXsQ4TWLnZmxc2ekar/lSGIlprCA==",
"dev": true,
"dependencies": {
"@eslint-community/eslint-utils": "^4.4.0",
"@types/json-schema": "^7.0.12",
"@types/semver": "^7.5.0",
"@typescript-eslint/scope-manager": "6.9.0",
"@typescript-eslint/types": "6.9.0",
"@typescript-eslint/typescript-estree": "6.9.0",
"@typescript-eslint/scope-manager": "6.9.1",
"@typescript-eslint/types": "6.9.1",
"@typescript-eslint/typescript-estree": "6.9.1",
"semver": "^7.5.4"
},
"engines": {
@ -2871,12 +2871,12 @@
}
},
"node_modules/@typescript-eslint/visitor-keys": {
"version": "6.9.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.0.tgz",
"integrity": "sha512-dGtAfqjV6RFOtIP8I0B4ZTBRrlTT8NHHlZZSchQx3qReaoDeXhYM++M4So2AgFK9ZB0emRPA6JI1HkafzA2Ibg==",
"version": "6.9.1",
"resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-6.9.1.tgz",
"integrity": "sha512-MUaPUe/QRLEffARsmNfmpghuQkW436DvESW+h+M52w0coICHRfD6Np9/K6PdACwnrq1HmuLl+cSPZaJmeVPkSw==",
"dev": true,
"dependencies": {
"@typescript-eslint/types": "6.9.0",
"@typescript-eslint/types": "6.9.1",
"eslint-visitor-keys": "^3.4.1"
},
"engines": {

View File

@ -1,6 +1,6 @@
{
"name": "@mobicoop/configuration",
"version": "2.3.0",
"version": "2.4.0",
"description": "Mobicoop V3 Configuration Service",
"author": "sbriat",
"private": true,
@ -24,9 +24,9 @@
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@grpc/grpc-js": "^1.9.8",
"@grpc/grpc-js": "^1.9.9",
"@grpc/proto-loader": "^0.7.10",
"@mobicoop/configuration-module": "^6.1.0",
"@mobicoop/configuration-module": "^7.2.1",
"@mobicoop/ddd-library": "^2.1.1",
"@mobicoop/health-module": "^2.3.1",
"@mobicoop/message-broker-module": "^2.1.1",
@ -48,11 +48,11 @@
"@nestjs/schematics": "^10.0.3",
"@nestjs/testing": "^10.2.7",
"@types/express": "^4.17.20",
"@types/jest": "29.5.6",
"@types/node": "^20.8.9",
"@types/jest": "29.5.7",
"@types/node": "^20.8.10",
"@types/supertest": "^2.0.15",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"@typescript-eslint/eslint-plugin": "^6.9.1",
"@typescript-eslint/parser": "^6.9.1",
"dotenv-cli": "^7.3.0",
"eslint": "^8.52.0",
"eslint-config-prettier": "^9.0.0",

View File

@ -18,6 +18,7 @@ import serviceConfig from './config/service.config';
import redisConfig from './config/redis.config';
import { Transport } from '@nestjs/microservices';
import matchConfig from './config/match.config';
import geographyConfig from './config/geography.config';
@Module({
imports: [
@ -26,6 +27,7 @@ import matchConfig from './config/match.config';
load: [
brokerConfig,
carpoolConfig,
geographyConfig,
matchConfig,
paginationConfig,
redisConfig,

View File

@ -0,0 +1,12 @@
import { registerAs } from '@nestjs/config';
import { Config } from './config';
export interface GeographyConfig extends Config {
georouterType: string;
georouterUrl: string;
}
export default registerAs('geography', () => ({
georouterType: process.env.GEOROUTER_TYPE ?? 'graphhopper',
georouterUrl: process.env.GEOROUTER_URL ?? 'http://localhost:8989',
}));

View File

@ -9,6 +9,7 @@ import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { CarpoolConfig } from '@src/config/carpool.config';
import { Config } from '@src/config/config';
import { GeographyConfig } from '@src/config/geography.config';
import { MatchConfig } from '@src/config/match.config';
import { PaginationConfig } from '@src/config/pagination.config';
@ -22,6 +23,12 @@ export class ConfigurationsManagerService {
...(this.configService.get<CarpoolConfig>('carpool') as CarpoolConfig),
domain: ConfigurationDomain.CARPOOL,
},
{
...(this.configService.get<GeographyConfig>(
'geography',
) as GeographyConfig),
domain: ConfigurationDomain.GEOGRAPHY,
},
{
...(this.configService.get<MatchConfig>('match') as MatchConfig),
domain: ConfigurationDomain.MATCH,

View File

@ -20,6 +20,11 @@ const mockConfigService = {
seatsRequested: 1,
strictFrequency: false,
};
case 'geography':
return {
type: 'graphhopper',
url: 'http://localhost:8989',
};
case 'match':
return {
algorithm: 'PASSENGER_ORIENTED',
@ -64,7 +69,7 @@ describe('Configurations Manager Service', () => {
it('should return the list of configuration elements', () => {
const list: Config[] = configurationsManagerService.list();
expect(list).toHaveLength(3);
expect(list).toHaveLength(4);
});
describe('identifierType', () => {