Skip to main content
Version: 13.x (Current)

Configuration

The main steps needed to customize the project according to your own business logic are listed below; in addition the project contains some TODO comment in order to highlight the necessary steps to customize the service.

Environment Variables

The table below shows the environment variables that are used by this service.

Variable nameVariable typeDescription
MODEFINANCE_BASE_URLstring (required)Base URL for the Modefinance APIs
MODEFINANCE_CLIENT_IDstring (required)Client ID to access Modefinance APIs
MODEFINANCE_CLIENT_SECRETstring (required)Client secret to access Modefinance APIs
ROUTER_URLstring (required)Base URL for the Flow Manager Router service
MAX_RETRIESint (required)Max retries to perform in case of http call
RETRIES_DELAY_MSint (required)Delay between retries in milliseconds
MODEstring (default = REST)Service working mode. REST or KAFKA
KAFKA_CONFIG_FILE_PATHstring (optional)Path to the file with Kafka configuration

The Platform variables USERID_HEADER_KEY, GROUPS_HEADER_KEY, CLIENTTYPE_HEADER_KEY, BACKOFFICE_HEADER_KEY, MICROSERVICE_GATEWAY_SERVICE_NAME are also required.

Kafka

Kafka can be enabled setting the MODE variable to KAFKA, in this case the KAFKA_CONFIG_FILE_PATH variable is required and REST endpoint is disabled. The configuration has the following schema:

{
"type": "object",
"required": [
"clientId",
"brokers",
"authMechanism",
"username",
"password",
"consumerConfig",
"producerConfig",
],
"properties": {
"clientId": { "type": "string"},
"brokers": { "type": "string"},
"authMechanism": { "type": "string"},
"username": { "type": "string"},
"password": { "type": "string"},
"connectionTimeout": { "type": "number"},
"authenticationTimeout": { "type": "number"},
"connectionRetries": { "type": "number"},
"consumerConfig": {
"type": "object",
"required": [
"groupId",
"topic",
],
"properties": {
"topic": { "type": "string" },
"groupId": { "type": "string" },
"sessionTimeout": { "type": "number" },
"rebalanceTimeout": { "type": "number" },
"heartbeatInterval": { "type": "number" },
"allowAutoTopicCreation": { "type": "boolean" },
},
},
"producerConfig": {
"type": "object",
"required": [
"topic",
],
"properties": {
"topic": { "type": "string" },
"allowAutoTopicCreation": { "type": "boolean" },
},
},
},
}

Refer to KafkaJS for the configuration meanings.

Service Logic

In order to customize the identification logic or integrate an external identification service you can modify the following files:

  • /src/lib/service.ts: contains custom identification logic
  • /src/restHandlers/service.ts and /src/kafkaHandlers/service.ts: contains service handlers
  • /src/clients/modefinanceClient.ts: contains the logic to perform calls to external service

Process Data

Data extracted can be modified before send them to main flow manager. In particular, a mapping function, defined in /src/services/mainFlowDataMapping.ts, is applied by default in order to manipulate the extracted data.