Entity API is used to create and manage tenants, entities, and wallets, within Codefi.
These tenants and entities are used by the Codefi APIs to identify the user, and partition data so its access is restricted.
- Install and run local-dev-env
- Copy
.env.sample
to.env
and update the values as needed - Start the service:
docker-compose up --build
Name | Description |
---|---|
PERFORM_INITIAL_CONFIGURATION | Whether to create tenants, entities, and wallets when starting the service. |
INITIAL_TENANTS_TO_CREATE | A JSON array of tenants to create on startup. |
INITIAL_ENTITIES_TO_CREATE | A JSON array of entities to create on startup. |
INITIAL_WALLETS_TO_CREATE | A JSON array of wallets to create on startup. |
Name | Description |
---|---|
STORES | A JSON object containing the supported store IDs and their wallet types. |
STORES_FILE | A JSON file containing the supported store IDs and their wallet types. |
Name | Description |
---|---|
RECOVERY_MODE | Whether to start the service in recovery mode and regenerate the database using Kafka. |
RECOVERY_MODE_TIMESTAMP | The Unix time from which to replay Kafka messages, used by the recovery mode. |
npm test
npm run test:cov
Integration tests are written in Jest and require a running instance of the service.
docker exec entity-api_ms_1 npm run test:integration
docker exec entity-api_ms_1 npm run test:integration:<TEST-NAME>
- tenant:get
- tenant:create
- tenant:update
- tenant:delete
- tenant-client:get
- tenant-client:create
- entity:get
- entity:create
- entity:update
- entity:delete
- entity-client:get
- entity-client:create
- wallet:get
- wallet:create
- wallet:update
- wallet:delete
- consumer:user-created
- orchestrate:wallet
Load tests are written using K6 and ran via a Docker container to encapsulate the required dependencies.
npm run test:load
npm run test:load:<TEST-NAME>
- endpoint
- endpoint:tenant:create
- endpoint:tenant:update
- endpoint:tenant:delete
- endpoint:entity:create
- endpoint:entity:update
- endpoint:entity:delete
- endpoint:wallet:create
- endpoint:wallet:update
- endpoint:wallet:delete
- kafka
- kafka:tenant:create
- kafka:tenant:update
- kafka:tenant:delete
- kafka:entity:create
- kafka:entity:update
- kafka:entity:delete
- kafka:wallet:create
- kafka:wallet:update
- kafka:wallet:delete