Configuration reference
The gateway reads one configuration file, config.yaml in this documentation, when it starts: slay400-gateway run --config config.yaml. It is YAML, at most 1 MiB, in UTF-8. The gateway checks the whole file before it listens, reports every problem with its line and column and a code from GWY001 to GWY009 or GWY015, and does not start while one is left; slay400-gateway check --config config.yaml does the same and exits. A change to the file takes effect at the next start; bundles and certificate files are taken without a restart (see reload).
A value can be, or contain, a ${NAME} placeholder: the gateway puts in the value of the environment variable NAME at start, and stops with GWY007 if it is not set. Credentials and the key password must be exactly one placeholder (GWY015): a value written in the file is refused.
server
Section titled “server”The API listener serves the operations at /<tenant>/<environment>/<route> and the health checks /health/live and /health/ready. Earlier development builds named its address server.host; that key is now refused with GWY002 and a message that names server.address.
With server.tls, a certificate or key that is missing, unreadable, not PEM, not matching each other, expired or not valid yet stops the start (GWY022 to GWY024); a certificate that expires within 30 days is a warning (GWY025). The two files are polled every reload.intervalSeconds and a new pair is used for new connections.
| Key | Type | Required | Default | Limits | A change takes effect | Meaning |
|---|---|---|---|---|---|---|
server |
section | no | at a restart | The API listener: it serves the operations and the health checks. | ||
server.address |
text | no | 127.0.0.1 |
no white space | at a restart | The address the API listener listens on; 0.0.0.0 for every address. |
server.port |
whole number | no | 8080 |
1 to 65535 | at a restart | The port of the API listener. |
server.tls |
section | no | at a restart | With this section the API listener speaks HTTPS only, TLS 1.3 and 1.2; without it, plain HTTP. | ||
server.tls.certificate |
file name | with server.tls | PEM: the certificate, then its chain | at a restart | The certificate of the API listener, relative to the configuration file. | |
server.tls.key |
file name | with server.tls | PEM, PKCS#8 | at a restart | The private key of the certificate, relative to the configuration file. | |
server.tls.keyPassword |
placeholder | for an encrypted key | a single ${NAME} | at a restart | The environment variable that holds the password of an encrypted key. |
management
Section titled “management”The management listener speaks plain HTTP and serves the health checks /health/live and /health/ready. Keep it on an address that only your monitoring reaches.
| Key | Type | Required | Default | Limits | A change takes effect | Meaning |
|---|---|---|---|---|---|---|
management |
section | no | at a restart | The management listener, plain HTTP: the health checks, never an operation. | ||
management.address |
text | no | 127.0.0.1 |
no white space | at a restart | The address the management listener listens on. |
management.port |
whole number | no | 9090 |
0 to 65535; 0 turns the listener off | at a restart | The port of the management listener. |
reload
Section titled “reload”While it runs, the gateway looks at its bundle files every reload.intervalSeconds and serves a new set of bundles without a restart, once the files are the same at two looks in a row. A set that fails its checks is refused with one warning, and the set in use stays. The configuration file itself is not read again.
| Key | Type | Required | Default | Limits | A change takes effect | Meaning |
|---|---|---|---|---|---|---|
reload |
section | no | at a restart | How the gateway looks for new bundles while it runs. | ||
reload.intervalSeconds |
whole number | no | 10 |
0 to 3600; 0 turns reloading off | at a restart | How often, in seconds, the bundle files and the certificate files are looked at. |
tenants
Section titled “tenants”The Community Edition serves one tenant (GWY008). The tenant name is the first segment of every address.
| Key | Type | Required | Default | Limits | A change takes effect | Meaning |
|---|---|---|---|---|---|---|
tenants |
section | yes | Community Edition: 1 tenant | at a restart | The tenants, by name. A name has lower-case letters, digits and -, starts with a letter or a digit, and is not health. | |
tenants.<tenant>.bundles |
list of file or folder names | yes | at least one | at a restart | The bundles of the tenant, relative to the configuration file: a bundle file, or a folder whose *.rpgapi files are served, in name order. | |
tenants.<tenant>.environments |
section | yes | at a restart | The environments of the tenant, by name, with the same rule for names as the tenants. |
environments
Section titled “environments”The environment name is the second segment of every address. An environment with backend: mock needs nothing else. An environment with backend: ibmi needs JT400 (JTOpen), which the gateway does not include, and every key marked “with backend: ibmi”; those keys are refused with GWY002 in a mock environment. The Community Edition has one credential pair per tenant and environment.
| Key | Type | Required | Default | Limits | A change takes effect | Meaning |
|---|---|---|---|---|---|---|
tenants.<tenant>.environments.<environment>.code |
text | yes | at a restart | The code of the environment, which a bundle can pass to a program as ${environment.code}. | ||
tenants.<tenant>.environments.<environment>.backend |
mock or ibmi | yes | at a restart | mock answers from the mock definitions of the bundle; ibmi calls the programs on an IBM i. | ||
tenants.<tenant>.environments.<environment>.host |
text | with backend: ibmi | a host name or an address, without scheme, path or port | at a restart | The IBM i that the environment calls. | |
tenants.<tenant>.environments.<environment>.libraryList |
list of library names | with backend: ibmi | 1 to 250 names of 1 to 10 characters | at a restart | The library list of the jobs that run the programs. | |
tenants.<tenant>.environments.<environment>.credentials |
section | with backend: ibmi | at a restart | The sign-on of the environment. | ||
tenants.<tenant>.environments.<environment>.credentials.user |
placeholder | with backend: ibmi | a single ${NAME} | at a restart | The environment variable that holds the user. | |
tenants.<tenant>.environments.<environment>.credentials.password |
placeholder | with backend: ibmi | a single ${NAME} | at a restart | The environment variable that holds the password. | |
tenants.<tenant>.environments.<environment>.tls |
true or false | no | true |
at a restart | Whether the connections to the IBM i use TLS. | |
tenants.<tenant>.environments.<environment>.pool |
section | no | at a restart | The connections to the IBM i. | ||
tenants.<tenant>.environments.<environment>.pool.maxConnections |
whole number | no | 4 |
1 to 64 | at a restart | The most connections open at once to the IBM i. |
tenants.<tenant>.environments.<environment>.callTimeoutSeconds |
whole number | no | 30 |
1 to 3600 | at a restart | How long, in seconds, a call may take before it is given up. |
Complete example
Section titled “Complete example”Every key, with a mock and an ibmi environment. The gateway starts with it, as a test of this repository checks, once bundles/ holds a bundle, tls/ holds the certificate and its encrypted key, and the environment variables are set.
# Every key of the gateway's configuration file. Started by ConfigurationExampleTest.
server:
address: 0.0.0.0
port: 8443
tls:
certificate: tls/tls.crt
key: tls/tls.key
keyPassword: ${TLS_KEY_PASSWORD}
management:
address: 127.0.0.1
port: 9090
reload:
intervalSeconds: 10
tenants:
acme:
bundles:
- ./bundles
environments:
test:
code: T0001
backend: mock
prod:
code: P0001
backend: ibmi
host: ${IBMI_HOST}
libraryList: [APPLIB, QGPL]
credentials:
user: ${IBMI_USER}
password: ${IBMI_PASSWORD}
tls: true
pool:
maxConnections: 4
callTimeoutSeconds: 30