mirror of
https://gitlab.com/mobicoop/v3/service/configuration.git
synced 2026-01-11 06:42:39 +00:00
extract config files
This commit is contained in:
11
src/config/broker.config.ts
Normal file
11
src/config/broker.config.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('broker', () => ({
|
||||
uri: process.env.MESSAGE_BROKER_URI ?? 'amqp://v3-broker:5672',
|
||||
exchange: process.env.MESSAGE_BROKER_EXCHANGE ?? 'mobicoop',
|
||||
durability: process.env.MESSAGE_BROKER_EXCHANGE_DURABILITY
|
||||
? process.env.MESSAGE_BROKER_EXCHANGE_DURABILITY === 'false'
|
||||
? false
|
||||
: true
|
||||
: true,
|
||||
}));
|
||||
19
src/config/carpool.config.ts
Normal file
19
src/config/carpool.config.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('carpool', () => ({
|
||||
departureTimeMargin: process.env.DEPARTURE_TIME_MARGIN
|
||||
? parseInt(process.env.DEPARTURE_TIME_MARGIN, 10)
|
||||
: 900,
|
||||
role: process.env.ROLE ?? 'passenger',
|
||||
seatsProposed: process.env.SEATS_PROPOSED
|
||||
? parseInt(process.env.SEATS_PROPOSED, 10)
|
||||
: 3,
|
||||
seatsRequested: process.env.SEATS_REQUESTED
|
||||
? parseInt(process.env.SEATS_REQUESTED, 10)
|
||||
: 1,
|
||||
strictFrequency: process.env.STRICT_FREQUENCY
|
||||
? process.env.STRICT_FREQUENCY === 'false'
|
||||
? false
|
||||
: true
|
||||
: false,
|
||||
}));
|
||||
7
src/config/database.config.ts
Normal file
7
src/config/database.config.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('database', () => ({
|
||||
url:
|
||||
process.env.DATABASE_URL ??
|
||||
'postgresql://mobicoop:mobicoop@v3-db:5432/mobicoop?schema=configuration',
|
||||
}));
|
||||
5
src/config/pagination.config.ts
Normal file
5
src/config/pagination.config.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('pagination', () => ({
|
||||
perPage: process.env.PER_PAGE ? parseInt(process.env.PER_PAGE, 10) : 10,
|
||||
}));
|
||||
8
src/config/service.config.ts
Normal file
8
src/config/service.config.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
export default registerAs('service', () => ({
|
||||
url: process.env.SERVICE_URL ?? '0.0.0.0',
|
||||
port: process.env.SERVICE_PORT
|
||||
? parseInt(process.env.SERVICE_PORT, 10)
|
||||
: 5003,
|
||||
}));
|
||||
Reference in New Issue
Block a user