The gateway configuration is one TOML 1.1 file. gqlgw parses it with
its own parser, which passes the whole toml-test corpus. Every section is optional except one
[sources.<name>] per source used by the schema.
flowchart LR
t[gqlgw.toml] --> g["[gateway]<br/>listen, path, schema, …"]
t --> l["[limits]"]
t --> c["[cache]<br/>[cache.memcached]"]
t --> n["[nginx]<br/>init, resolver"]
t --> m["[metrics]<br/>[purge]"]
t --> s["[sources.users]<br/>[sources.posts]<br/>…"]
Every string value can use the environment. Interpolation happens in gqlc render, when the
container starts; gqlc compile only checks the syntax.
Syntax
Result
${VAR}
the value; error if VAR is not set
${VAR:-default}
the value, or default if VAR is unset or empty
${VAR:?message}
the value; error with message if unset or empty
$${
a literal ${
$ alone
a literal $ (regexes like ^Foo$, keys like k$y need no escaping)
A typed field can be written as a string to use a variable: port = "${MEMCACHED_PORT:-11211}",
debug_headers = "${DEBUG:-false}". The result is converted to the expected type.
# Default mode: `gqlc render` writes one file, gqlgw.conf, with its own server {}.## gqlc compile -c gqlgw.toml ../docker/schema.graphqls # -> schema.gqlb, schema.routes.lua# gqlc render -c gqlgw.toml -o /etc/nginx/gqlgw # -> gqlgw.conf, gqlgw.lua# # nginx.conf, inside http { }: include /etc/nginx/gqlgw/gqlgw.conf;[gateway]listen="0.0.0.0:8080 reuseport"server_name="api.example.com"path="/graphql"access_log="logs/gqlgw.access.log"# format "gqlgw": rounds, subrequests, cache hitsintrospection=truemax_body="256k"[limits]depth=20rounds=8response_bytes="4m"[cache]shm_size="128m"# L2, shared by the workers of this nodel2_ttl=5[cache.memcached]# L3, shared by every nodehost="${MEMCACHED_HOST:-127.0.0.1}"port=11211timeout=50# ms[nginx]resolver="auto"# nameservers of /etc/resolv.conf, read by gqlc render[metrics]port=8191path="/gqlgw_metrics"allow=["127.0.0.1","10.0.0.0/8"]exclude_operations=["^IntrospectionQuery$"][purge]path="/gqlgw_purge"[sources.users]url="${USERS_URL:-http://users.internal:8080/api/v1}"read_timeout="2s"[sources.posts]url="${POSTS_URL:-https://posts.internal}"forward_headers=["Authorization","Accept-Language"]