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
|
||||
|
||||
Configuration items management. Used to configure all services using a broker to disseminate the configuration items.
|
||||
|
||||
This service handles the persistence of the configuration items of all services in a database, and sends values _via_ the broker.
|
||||
Configuration items management. Used to configure and store all services using redis as database.
|
||||
|
||||
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 **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)
|
||||
|
@ -17,9 +14,10 @@ Practically, it's the other way round as it's easier to use this configuration s
|
|||
|
||||
## Available domains
|
||||
|
||||
- **AD** : ad related configuration items
|
||||
- **MATCHER** : matching algotithm related configuration items
|
||||
- **USER** : user related configuration items
|
||||
- **CARPOOL** : carpool related configuration items (eg. default number of seats proposed as a driver)
|
||||
- **PAGINATION** : pagination related configuration items (eg. default number of results per page)
|
||||
|
||||
New domains will be added in the future depending on the needs !
|
||||
|
||||
## Requirements
|
||||
|
||||
|
@ -57,11 +55,7 @@ A RabbitMQ instance is also required to send / receive messages when data has be
|
|||
|
||||
## Database migration
|
||||
|
||||
Before using the app, you need to launch the database migration (it will be launched inside the container) :
|
||||
|
||||
```bash
|
||||
npm run migrate
|
||||
```
|
||||
Redis database is automatically populated at the start of the service. If keys already exists in the database, items are preserved.
|
||||
|
||||
## Usage
|
||||
|
||||
|
@ -71,52 +65,24 @@ The app exposes the following [gRPC](https://grpc.io/) services :
|
|||
|
||||
```json
|
||||
{
|
||||
"domain": "AD",
|
||||
"domain": "CARPOOL",
|
||||
"key": "seatsProposed"
|
||||
}
|
||||
```
|
||||
|
||||
- **Set** : create or update a configuration item
|
||||
- **Set** : update a configuration item
|
||||
|
||||
```json
|
||||
{
|
||||
"domain": "USER",
|
||||
"key": "key1",
|
||||
"value": "value1"
|
||||
"domain": "CARPOOL",
|
||||
"key": "seatsProposed",
|
||||
"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 are run outside the container for ease of use (switching between different environments inside containers using prisma is complicated and error prone).
|
||||
The integration tests use a dedicated database (see _db-test_ section of _docker-compose.yml_).
|
||||
Tests are run outside the container for ease of use.
|
||||
|
||||
```bash
|
||||
# run all tests (unit + integration)
|
||||
|
|
|
@ -13,7 +13,6 @@ export interface CreateConfigurationProps {
|
|||
export enum ConfigurationDomain {
|
||||
CARPOOL = 'CARPOOL',
|
||||
PAGINATION = 'PAGINATION',
|
||||
USER = 'USER',
|
||||
}
|
||||
|
||||
export type ConfigurationIdentifier = {
|
||||
|
|
Loading…
Reference in New Issue