update readme
This commit is contained in:
parent
4b90de2321
commit
c8d51e0ec9
58
README.md
58
README.md
|
@ -1,12 +1,9 @@
|
||||||
# Mobicoop V3 - Configuration Service
|
# Mobicoop V3 - Configuration Service
|
||||||
|
|
||||||
Configuration items management. Used to configure all services using a broker to disseminate the configuration items.
|
Configuration items management. Used to configure and store all services using redis as database.
|
||||||
|
|
||||||
This service handles the persistence of the configuration items of all services in a database, and sends values _via_ the broker.
|
|
||||||
|
|
||||||
Each item consists in :
|
Each item consists in :
|
||||||
|
|
||||||
- a **uuid** : a unique identifier for the configuration item
|
|
||||||
- a **domain** : each service is associated with one or more domains, represented by an uppercase string (eg. _USER_)
|
- a **domain** : each service is associated with one or more domains, represented by an uppercase string (eg. _USER_)
|
||||||
- a **key** : the key of the configuration item (a string)
|
- a **key** : the key of the configuration item (a string)
|
||||||
- a **value** : the value of the configuration item (always a string, each service must cast the value if needed)
|
- a **value** : the value of the configuration item (always a string, each service must cast the value if needed)
|
||||||
|
@ -17,9 +14,10 @@ Practically, it's the other way round as it's easier to use this configuration s
|
||||||
|
|
||||||
## Available domains
|
## Available domains
|
||||||
|
|
||||||
- **AD** : ad related configuration items
|
- **CARPOOL** : carpool related configuration items (eg. default number of seats proposed as a driver)
|
||||||
- **MATCHER** : matching algotithm related configuration items
|
- **PAGINATION** : pagination related configuration items (eg. default number of results per page)
|
||||||
- **USER** : user related configuration items
|
|
||||||
|
New domains will be added in the future depending on the needs !
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
@ -57,11 +55,7 @@ A RabbitMQ instance is also required to send / receive messages when data has be
|
||||||
|
|
||||||
## Database migration
|
## Database migration
|
||||||
|
|
||||||
Before using the app, you need to launch the database migration (it will be launched inside the container) :
|
Redis database is automatically populated at the start of the service. If keys already exists in the database, items are preserved.
|
||||||
|
|
||||||
```bash
|
|
||||||
npm run migrate
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
|
@ -71,52 +65,24 @@ The app exposes the following [gRPC](https://grpc.io/) services :
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"domain": "AD",
|
"domain": "CARPOOL",
|
||||||
"key": "seatsProposed"
|
"key": "seatsProposed"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Set** : create or update a configuration item
|
- **Set** : update a configuration item
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"domain": "USER",
|
"domain": "CARPOOL",
|
||||||
"key": "key1",
|
"key": "seatsProposed",
|
||||||
"value": "value1"
|
"value": "3"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
- **Delete** : delete a configuration item by its domain and key
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"domain": "AD",
|
|
||||||
"key": "seatsProposed"
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
- **Propagate** : propagate all configuration items using the message broker
|
|
||||||
|
|
||||||
```json
|
|
||||||
{}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Messages
|
|
||||||
|
|
||||||
As mentionned earlier, RabbitMQ messages are sent after these events :
|
|
||||||
|
|
||||||
- **Set** (message : the created / updated configuration item informations)
|
|
||||||
|
|
||||||
- **Delete** (message : the uuid of the deleted configuration item)
|
|
||||||
|
|
||||||
- **Propagate** (message : all the configuration items)
|
|
||||||
|
|
||||||
Various messages are also sent for logging purpose.
|
|
||||||
|
|
||||||
## Tests / ESLint / Prettier
|
## Tests / ESLint / Prettier
|
||||||
|
|
||||||
Tests are run outside the container for ease of use (switching between different environments inside containers using prisma is complicated and error prone).
|
Tests are run outside the container for ease of use.
|
||||||
The integration tests use a dedicated database (see _db-test_ section of _docker-compose.yml_).
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# run all tests (unit + integration)
|
# run all tests (unit + integration)
|
||||||
|
|
|
@ -13,7 +13,6 @@ export interface CreateConfigurationProps {
|
||||||
export enum ConfigurationDomain {
|
export enum ConfigurationDomain {
|
||||||
CARPOOL = 'CARPOOL',
|
CARPOOL = 'CARPOOL',
|
||||||
PAGINATION = 'PAGINATION',
|
PAGINATION = 'PAGINATION',
|
||||||
USER = 'USER',
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ConfigurationIdentifier = {
|
export type ConfigurationIdentifier = {
|
||||||
|
|
Loading…
Reference in New Issue