mirror of
https://gitlab.com/mobicoop/v3/service/configuration.git
synced 2026-01-09 16:32:40 +00:00
add geographyConfig
This commit is contained in:
@@ -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,
|
||||
|
||||
12
src/config/geography.config.ts
Normal file
12
src/config/geography.config.ts
Normal 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',
|
||||
}));
|
||||
@@ -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,
|
||||
|
||||
@@ -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', () => {
|
||||
|
||||
Reference in New Issue
Block a user