Configuration loading is designed for containerization in mind. The container engine and orchestrator can mount volumes (secret or regular) as well as set the environment variables as outlined below.
You may set configurations through both files and environment variables. Please note that environment variables will
override the settings in the configuration files. The configuration files are all expected to be in YAML
format.
The configuration loader will search for the configurations in the following order:
Location | Details |
---|---|
/etc/FTeX.conf/ |
The etc directory is the canonical location for configurations. |
$HOME/.FTeX/ |
Configurations can be located in the user's home directory. |
./configs/ |
The config folder in the root directory where the application is located. |
Environment variables | Finally, the configurations will be loaded from environment variables and override configuration files |
The expected file name is HTTPRESTConfig.yaml
. All the configuration items below are required.
Name | Environment Variable Key | Type | Description |
---|---|---|---|
Server | REST_SERVER |
Parent key for server configurations. | |
↳ portNumber | ↳ .PORTNUMBER |
int | Service port for inbound and outbound connections. |
↳ basePath | ↳ .BASEPATH |
string | The service endpoints base path. |
↳ swaggerPath | ↳ .SWAGGERPATH |
string | The path through which the Swagger UI will be accessible. |
↳ shutdownDelay | ↳ .SHUTDOWNDELAY |
time.Duration | The number of seconds to wait after a shutdown signal is received to terminate the server. |
↳ readTimeout | ↳ .READTIMEOUT |
time.Duration | The maximum duration to read an entire request with the body before timing out. |
↳ writeTimeout | ↳ .WRITETIMEOUT |
time.Duration | The maximum duration to write entire response before timing out. |
↳ ReadHeaderTimeout | ↳ .READHEADERTIMEOUT |
time.Duration | The maximum duration to read an entire request header before timing out. |
Authorization | REST_AUTHORIZATION |
Parent key for authentication configurations. | |
↳ headerKey | ↳ .HEADERKEY |
string | The HTTP header key where the authorization token is stored. |
server:
portNumber: 33723
basePath: api/rest/v1
swaggerPath: /swagger/*any
shutdownDelay: 5s
readTimeout: 1s
writeTimeout: 1s
readHeaderTimeout: 1s
authorization:
headerKey: Authorization
export REST_SERVER.PORTNUMBER=33723
export REST_SERVER.BASEPATH=api/rest/v1
The Swagger UI is accessible through the endpoint URL that is provided in the configurations to view the REST schemas as well as issue test requests to the endpoints.