Gateway Configuration

1. Description

Gateway Configuration is an Environment Configuration that is dedicated to averos services.
A gateway configuration defines a service gateway configuration along with multiple service-to-api bindings.

When a Gateway configuration is available, Averos services relies on the service-to-api bindings that are configured in the gateway configuration in order to bind itself to a specific api.

A Gateway Configuration instance is composed of the following attributes that define the api location mapping:

  • gatewayHost: defines the target gateway host
  • gatewayPort: defines the target gateway listening port
  • gatewayProtocol: defines the gateway protocol (http, https)
  • apiEndpoints: defines a list of target apis configurations with the following attributes:
    • id : defines the configuration identifier. Should match the related service class name.
    • endpoint : defines the target api uri

Just like Service Configurations, Gateway configuration is a great way to modify the service-to-api bindings without the need to modify or redeploy the application while using an api gateway. A simple application reload will apply the changes to the application.

2. Workflow Command: averos-config

a. Description

Adding an averos business service could be achieved either manually or by means of the dedicated workflow command averos-config.

🚩 We recommend using averos-config command while binding services to apis so that the required guidelines aspects along with the related validations could be done automatically.

b. Command Usage

Below is the full detailed workflow command line:

ng g @wiforge/averos:averos-config --id=APIServiceGateway --type=gateway --host= --port=8888 --protocol=https --endpoint=/srv1

c. Input Parameters

  • id: Mandatory / fixed value = APIServiceGateway. Defines the class name of the related service
  • type: Mandatory / fixed value = gateway. Defines the type of the configuration. Equal to gateway
  • host, port, protocol, endpoint: gateway location attributes

d. Output

The command will result in the creation of a gateway configuration binding.

🚩 Please consider using the service configuration command detailed in the previous section in order to create the gateway related apiEndpoints. Also, note that GatewayConfiguration has bigger weight than ServiceConfiguration. This means that if both exist in the application then service will be bound to the apis that are listed in the GetewayConfiguration.
Similarely, when both configuration types exist, adding a new ServiceConfiguration using averos-config will result in updating the list of apiEndpoints available in the GatewayConfiguration.

🚩 Only one GatewayConfiguration should exist within an averos application.