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 hostgatewayPort
: defines the target gateway listening portgatewayProtocol
: 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=127.0.0.1 --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 togateway
- 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 thatGatewayConfiguration
has bigger weight thanServiceConfiguration
. This means that if both exist in the application then service will be bound to the apis that are listed in theGetewayConfiguration
.
Similarely, when both configuration types exist, adding a newServiceConfiguration
usingaveros-config
will result in updating the list ofapiEndpoints
available in theGatewayConfiguration
.
π© Only one
GatewayConfiguration
should exist within an averos application.