GraphQL Portal Gateway server is configured from
gateway.json|yaml file which should be located in a directory
relative to the command.
For example, if we are launching
graphql-portal command from
/opt/graphql-portal directory, then the gateway configuration
should be located in
It is possible to use the gateway with static configuration files, in that case you have to set
When done so, the gateway will try to load API Configurations from the directories specified in the following options:
In all of the above options, the path is relative to the directory in which we launch the gateway, i.e. if we are launching
the server in
/opt/graphql-portal and the
apis_path is set to
config/apis, then we'll look for the files in
The combination of these options allows us to have a flexible configuration structure with separation of concerns, which if necessary can then be versioned. Here is an example of a typical configuration structure:
Our directory listing will then look like that:
It is possible to override certain configuration options by using environment variables. To do that, you'll have to replace
the values of the variables in the configuration file with
For example, lets take the following configuration file:
As you can see, there are three values which were replaced with
@@VARIABLE. Values which were specified in that way are
going to be taken from the environment variables.
The hostname to bind the gateway node to.
The port on which GraphQL Portal Gateway will listen for the incoming connections.
Optional string. This value should be set to the external server name when gateway is used behind the load-balancer proxy.
Optional number. The size of the NodeJS Cluster pool, i.e. how many instances of the gateway are going to be launched on the same host. It is recommended to keep this number equal to the number of CPU cores on the machine. Setting this value to 1 will launch a single-instance gateway. Setting it to 0 or removing it will use all the available CPU cores on the machine.
This boolean value specifies whether to read the API configurations from the local file or from a GraphQL Portal Dashboard.
If set to
false, the gateway will try to read the configuration files locally and will search for them in the locations
specified in the following configuration options:
If set to
true, it will try to connect to dashboard (see below for dashboard configuration) and get the configuration
Optional. This value will be used only when
use_dashboard_configs is set to
It contains a required options
connection_string, which specifies the URL and connection parameters to the Dashboard.
Path to a directory with API definition files. Read more about API Configuration Files here.
Path to a directory with custom middlewares. API Configuration Files here
Path to a directory with data source files. API Configuration Files here
Enables or disables the Control API which is used to update GraphQL Schema definitions.
Optional. Used only when
enable_control_api is set to
true. Contains only one property
endpoint which specifies
the URL path on which to which the Control API will be bind.
Optional. Enables and configures CORS requests.
CORS requests from Dashboard are enabled by default when
use_dashboard_configs is set to true.
false by default. Enables CORS configuration.
Array of strings. Configures the Access-Control-Allow-Origin CORS header. Expects an Array of valid origins.
Array of strings. Configures the Access-Control-Allow-Methods CORS header. Expects an array of HTTP Methods.
Array of strings. Configures the Access-Control-Allow-Headers CORS header. Expects and Array of headers.
Array of strings. Configures the Access-Control-Expose-Headers CORS header.
Array of strings. Configures the Access-Control-Allow-Credentials CORS header.
Integer. Configures the Access-Control-Max-Age CORS header.
Integer. Provides a status code to use for successful OPTIONS requests, since some legacy browsers (IE11, various SmartTVs) choke on 204.
Boolean. Enables metrics gathering. Disabled by default.
Optional. Can be
json. Default value is
Possible values are: 'debug' | 'info' | 'warn' | 'error'.
Configures sending of log messages to Datadog.
Boolean. Enable or disable logging to Datadog. Defaults to false.
String. Datadog API key of your application.
String. Host of the Datadog TCP (TLS) intake. Defaults to the US server (intake.logs.datadoghq.com).
Number. Port of the Datadog TCP (TLS) intake. Defaults to 10516.
String. Adds an environment attribute to Datadog logs. Empty by default.
Array of strings. Allows transport level tagging in Datadog. Each tag should follow the format
<KEY>:<VALUE>. For more information see https://docs.datadoghq.com/getting_started/tagging/.
Configures sending of log messages to Redis.
Boolean. Enable or disable logging to Redis. Defaults to false.
Number. Timeout in seconds, after the timeout has expired, the log will automatically be deleted, 30 by default.
Redis connection options.
Connection string specifying access to a Redis instance, for example:
redis_connection_string is deprecated. Use
If you want to connect to a Redis cluster:
Optional. Default value is 100kb. This value specifies an HTTP Request size limit. Accepts numeric (in bytes) or string values. When string is used, the following abbreviations are used:
- b for bytes
- kb for kilobytes
- mb for megabytes
- gb for gigabytes
- tb for terabytes
- pb for petabytes.
Optional. Configures tracing provides. Currently available providers:
Boolean or name of provider in lowercase (
"datadog"). Enable or disable tracing. Defaults to false.
Optional. Configures sending of traces to Jaeger.
The host of your Jaeger agent. Defaults to "localhost".
The port of your Jaeger agent. Defaults to 6832.
Optional. Configures sending of traces to Datadog.
The host of your Datadog agent. Defaults to localhost.
The port of your Datadog agent. Defaults to 8126.