2020-01-14 15:57:45 +03:00
|
|
|
.. meta::
|
2021-04-06 20:04:53 +03:00
|
|
|
:description: Hasura GraphQL engine server config reference
|
|
|
|
:keywords: hasura, docs, deployment, server, config, flags, env vars
|
2020-01-14 15:57:45 +03:00
|
|
|
|
2020-03-11 22:42:36 +03:00
|
|
|
.. _server_flag_reference:
|
|
|
|
|
2021-04-06 20:04:53 +03:00
|
|
|
GraphQL engine server config reference
|
|
|
|
======================================
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2018-12-03 15:12:24 +03:00
|
|
|
.. contents:: Table of contents
|
|
|
|
:backlinks: none
|
|
|
|
:depth: 1
|
|
|
|
:local:
|
|
|
|
|
2020-08-25 14:53:25 +03:00
|
|
|
Introduction
|
|
|
|
------------
|
|
|
|
|
2018-09-11 14:11:24 +03:00
|
|
|
Every GraphQL engine command is structured as:
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
2018-10-26 05:59:36 +03:00
|
|
|
$ graphql-engine <server-flags> serve <command-flags>
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
The flags can be passed as ENV variables as well.
|
|
|
|
|
2021-04-06 20:04:53 +03:00
|
|
|
Server config
|
|
|
|
-------------
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-09-11 10:17:14 +03:00
|
|
|
For the ``graphql-engine`` command these are the available flags and ENV variables:
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
.. list-table::
|
|
|
|
:header-rows: 1
|
2019-05-07 15:21:37 +03:00
|
|
|
:widths: 15 20 30
|
2019-02-14 08:58:38 +03:00
|
|
|
|
|
|
|
* - Flag
|
|
|
|
- ENV variable
|
|
|
|
- Description
|
|
|
|
|
|
|
|
* - ``--database-url <DB_URL>``
|
|
|
|
- ``HASURA_GRAPHQL_DATABASE_URL``
|
|
|
|
- Postgres database URL:
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
``postgres://<user>:<password>@<host>:<port>/<db-name>``
|
|
|
|
|
|
|
|
Example: ``postgres://admin:mypass@mydomain.com:5432/mydb``
|
|
|
|
|
2021-02-19 13:13:25 +03:00
|
|
|
* - ``--metadata-database-url <METADATA-DATABASE-URL>``
|
|
|
|
- ``HASURA_GRAPHQL_METADATA_DATABASE_URL``
|
2021-02-23 15:00:19 +03:00
|
|
|
- Postgres database URL that will be used to store the Hasura metadata. By default the database configured using ``HASURA_GRAPHQL_DATABASE_URL``
|
2021-03-04 22:20:19 +03:00
|
|
|
will be used to store the metadata. *(Available for versions > v2.0.0)*
|
2021-02-19 13:13:25 +03:00
|
|
|
|
|
|
|
``postgres://<user>:<password>@<host>:<port>/<db-name>``
|
|
|
|
|
|
|
|
Example: ``postgres://admin:mypass@mydomain.com:5432/metadata_db``
|
2021-03-31 14:02:53 +03:00
|
|
|
|
2019-09-11 10:17:14 +03:00
|
|
|
Or you can specify the following options *(only via flags)*:
|
2018-11-29 13:30:26 +03:00
|
|
|
|
|
|
|
.. code-block:: none
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2020-06-30 11:39:25 +03:00
|
|
|
--host Postgres server host
|
|
|
|
-p, --port Postgres server port
|
|
|
|
-u, --user Database user name
|
|
|
|
-p, --password Password of the user
|
|
|
|
-d, --dbname Database name to connect to
|
|
|
|
-o, --pg-connection-options PostgreSQL connection options
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
The default configuration of PostgreSQL 11 and older may result in loss of
|
|
|
|
precision when retrieving IEEE 754 style data, such as ``float4``, ``real``
|
|
|
|
or ``double precision`` values, from the database. To avoid this, set the
|
|
|
|
``extra_float_digits`` PostgreSQL connection parameter to 3. This can be
|
|
|
|
done by passing ``'--pg-connection-options=-c extra_float_digits=3'`` to
|
|
|
|
``graphql-engine``, or by passing this option as part of the database url:
|
|
|
|
|
|
|
|
``postgres://admin:mypass@mydomain.com:5432/mydb?options=-c%20extra_float_digits%3D3``
|
2019-02-14 08:58:38 +03:00
|
|
|
|
2019-05-16 09:13:25 +03:00
|
|
|
.. _command-flags:
|
|
|
|
|
2021-04-06 20:04:53 +03:00
|
|
|
Command config
|
|
|
|
--------------
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-09-11 10:17:14 +03:00
|
|
|
For the ``serve`` sub-command these are the available flags and ENV variables:
|
2018-12-03 14:19:08 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
.. list-table::
|
|
|
|
:header-rows: 1
|
2019-05-07 15:21:37 +03:00
|
|
|
:widths: 15 20 30
|
2018-12-03 14:19:08 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - Flag
|
|
|
|
- ENV variable
|
|
|
|
- Description
|
2018-12-03 14:19:08 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``--server-port <PORT>``
|
|
|
|
- ``HASURA_GRAPHQL_SERVER_PORT``
|
|
|
|
- Port on which graphql-engine should be served (default: 8080)
|
2018-12-03 14:19:08 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``--server-host <HOST>``
|
|
|
|
- ``HASURA_GRAPHQL_SERVER_HOST``
|
|
|
|
- Host on which graphql-engine will listen (default: ``*``)
|
2018-12-03 14:19:08 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``--enable-console <true|false>``
|
|
|
|
- ``HASURA_GRAPHQL_ENABLE_CONSOLE``
|
2019-09-19 15:54:40 +03:00
|
|
|
- Enable the Hasura Console (served by the server on ``/`` and ``/console``) (default: false)
|
2018-12-03 14:19:08 +03:00
|
|
|
|
2019-02-14 14:14:25 +03:00
|
|
|
* - ``--admin-secret <ADMIN_SECRET_KEY>``
|
|
|
|
- ``HASURA_GRAPHQL_ADMIN_SECRET``
|
|
|
|
- Admin secret key, required to access this instance. This is mandatory
|
2019-02-14 08:58:38 +03:00
|
|
|
when you use webhook or JWT.
|
2019-01-11 14:07:13 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``--auth-hook <WEBHOOK_URL>``
|
|
|
|
- ``HASURA_GRAPHQL_AUTH_HOOK``
|
|
|
|
- URL of the authorization webhook required to authorize requests.
|
|
|
|
See auth webhooks docs for more details.
|
2019-01-18 17:20:41 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``--auth-hook-mode <GET|POST>``
|
|
|
|
- ``HASURA_GRAPHQL_AUTH_HOOK_MODE``
|
|
|
|
- HTTP method to use for the authorization webhook (default: GET)
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``--jwt-secret <JSON_CONFIG>``
|
|
|
|
- ``HASURA_GRAPHQL_JWT_SECRET``
|
|
|
|
- A JSON string containing type and the JWK used for verifying (and other
|
|
|
|
optional details).
|
|
|
|
Example: ``{"type": "HS256", "key": "3bd561c37d214b4496d09049fadc542c"}``.
|
|
|
|
See the JWT docs for more details.
|
2019-01-28 16:55:28 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``--unauthorized-role <ROLE>``
|
|
|
|
- ``HASURA_GRAPHQL_UNAUTHORIZED_ROLE``
|
|
|
|
- Unauthorized role, used when access-key is not sent in access-key only
|
2019-09-11 10:17:14 +03:00
|
|
|
mode or the ``Authorization`` header is absent in JWT mode.
|
|
|
|
Example: ``anonymous``. Now whenever the "authorization" header is
|
|
|
|
absent, the request's role will default to ``anonymous``.
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``--cors-domain <DOMAINS>``
|
|
|
|
- ``HASURA_GRAPHQL_CORS_DOMAIN``
|
2020-05-11 16:26:08 +03:00
|
|
|
- CSV of list of domains, incuding scheme (http/https) and port, to allow for CORS. Wildcard
|
|
|
|
domains are allowed. (See :ref:`configure-cors`)
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``--disable-cors``
|
2020-02-03 14:13:03 +03:00
|
|
|
- ``HASURA_GRAPHQL_DISABLE_CORS``
|
2019-02-14 08:58:38 +03:00
|
|
|
- Disable CORS. Do not send any CORS headers on any request.
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-03-06 11:58:04 +03:00
|
|
|
* - ``--ws-read-cookie <true|false>``
|
2019-03-04 10:46:53 +03:00
|
|
|
- ``HASURA_GRAPHQL_WS_READ_COOKIE``
|
2019-03-06 11:58:04 +03:00
|
|
|
- Read cookie on WebSocket initial handshake even when CORS is disabled.
|
2019-03-04 10:46:53 +03:00
|
|
|
This can be a potential security flaw! Please make sure you know what
|
2019-03-06 11:58:04 +03:00
|
|
|
you're doing. This configuration is only applicable when CORS is disabled.
|
|
|
|
(default: false)
|
2019-03-04 10:46:53 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``--enable-telemetry <true|false>``
|
|
|
|
- ``HASURA_GRAPHQL_ENABLE_TELEMETRY``
|
|
|
|
- Enable anonymous telemetry (default: true)
|
2018-12-14 06:21:41 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - N/A
|
|
|
|
- ``HASURA_GRAPHQL_EVENTS_HTTP_POOL_SIZE``
|
2020-06-15 11:40:15 +03:00
|
|
|
- Maximum number of concurrent http workers delivering events at any time (default: 100)
|
2019-01-18 17:20:41 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - N/A
|
|
|
|
- ``HASURA_GRAPHQL_EVENTS_FETCH_INTERVAL``
|
2020-04-24 10:55:51 +03:00
|
|
|
- Interval in milliseconds to sleep before trying to fetch events again after a fetch
|
2020-03-11 09:27:31 +03:00
|
|
|
returned no events from postgres
|
2018-12-14 06:21:41 +03:00
|
|
|
|
2021-04-27 20:22:54 +03:00
|
|
|
* - ``--events-fetch-batch-size``
|
|
|
|
- ``HASURA_GRAPHQL_EVENTS_FETCH_BATCH_SIZE``
|
|
|
|
- Maximum number of events to be fetched from the DB in a single batch (default: 100)
|
|
|
|
|
2021-03-31 14:02:53 +03:00
|
|
|
* - ``--async-actions-fetch-interval``
|
|
|
|
- ``HASURA_GRAPHQL_ASYNC_ACTIONS_FETCH_INTERVAL``
|
|
|
|
- Interval in milliseconds to sleep before trying to fetch async actions again after a fetch
|
|
|
|
returned no async actions from metadata storage. Value ``0`` implies completely disable fetching
|
|
|
|
async actions from the storage.
|
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``-s, --stripes <NO_OF_STRIPES>``
|
|
|
|
- ``HASURA_GRAPHQL_PG_STRIPES``
|
2019-12-12 23:10:04 +03:00
|
|
|
- Number of stripes (distinct sub-pools) to maintain with Postgres (default: 1).
|
|
|
|
New connections will be taken from a particular stripe pseudo-randomly.
|
2018-12-14 06:21:41 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``-c, --connections <NO_OF_CONNS>``
|
|
|
|
- ``HASURA_GRAPHQL_PG_CONNECTIONS``
|
2020-04-24 10:55:51 +03:00
|
|
|
- Maximum number of Postgres connections that can be opened per stripe (default: 50).
|
|
|
|
When the maximum is reached we will block until a new connection becomes available,
|
2019-12-12 23:10:04 +03:00
|
|
|
even if there is capacity in other stripes.
|
2021-05-13 19:52:08 +03:00
|
|
|
(Deprecated in versions > v2.0.0. :ref:`See details <hasura_v2_env_changes>`)
|
2018-11-29 13:30:26 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``--timeout <SECONDS>``
|
|
|
|
- ``HASURA_GRAPHQL_PG_TIMEOUT``
|
|
|
|
- Each connection's idle time before it is closed (default: 180 sec)
|
2021-05-13 19:52:08 +03:00
|
|
|
(Deprecated in versions > v2.0.0. :ref:`See details <hasura_v2_env_changes>`)
|
2018-11-29 13:30:26 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``--use-prepared-statements <true|false>``
|
|
|
|
- ``HASURA_GRAPHQL_USE_PREPARED_STATEMENTS``
|
|
|
|
- Use prepared statements for queries (default: true)
|
2021-05-13 19:52:08 +03:00
|
|
|
(Deprecated in versions > v2.0.0. :ref:`See details <hasura_v2_env_changes>`)
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
* - ``-i, --tx-iso <TXISO>``
|
|
|
|
- ``HASURA_GRAPHQL_TX_ISOLATION``
|
2019-09-11 10:17:14 +03:00
|
|
|
- Transaction isolation. read-committed / repeatable-read / serializable (default: read-commited)
|
2021-05-13 19:52:08 +03:00
|
|
|
(Deprecated in versions > v2.0.0. :ref:`See details <hasura_v2_env_changes>`)
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2021-02-02 13:39:39 +03:00
|
|
|
* - ``--retries <NO_OF_RETRIES>``
|
|
|
|
- ``HASURA_GRAPHQL_NO_OF_RETRIES``
|
|
|
|
- Number of retries if Postgres connection error occurs (default: 1)
|
2021-05-13 19:52:08 +03:00
|
|
|
(Deprecated in versions > v2.0.0. :ref:`See details <hasura_v2_env_changes>`)
|
|
|
|
|
|
|
|
* - ``--conn-lifetime <SECONDS>``
|
|
|
|
- ``HASURA_GRAPHQL_PG_CONN_LIFETIME``
|
|
|
|
- Time from connection creation after which the connection should be destroyed and a new one created.
|
|
|
|
A value of 0 indicates we should never destroy an active connection. If 0 is passed, memory from large query
|
|
|
|
results may not be reclaimed. (default: 600 sec)
|
|
|
|
(Deprecated in versions > v2.0.0. :ref:`See details <hasura_v2_env_changes>`)
|
2021-02-02 13:39:39 +03:00
|
|
|
|
2019-03-01 14:45:04 +03:00
|
|
|
* - ``--stringify-numeric-types``
|
|
|
|
- ``HASURA_GRAPHQL_STRINGIFY_NUMERIC_TYPES``
|
2019-03-06 11:58:04 +03:00
|
|
|
- Stringify certain Postgres numeric types, specifically ``bigint``, ``numeric``, ``decimal`` and
|
|
|
|
``double precision`` as they don't fit into the ``IEEE-754`` spec for JSON encoding-decoding.
|
|
|
|
(default: false)
|
2019-03-01 14:45:04 +03:00
|
|
|
|
2019-02-28 16:53:03 +03:00
|
|
|
* - ``--enabled-apis <APIS>``
|
|
|
|
- ``HASURA_GRAPHQL_ENABLED_APIS``
|
2019-04-30 11:34:08 +03:00
|
|
|
- Comma separated list of APIs (options: ``metadata``, ``graphql``, ``pgdump``) to be enabled.
|
|
|
|
(default: ``metadata,graphql,pgdump``)
|
2019-05-16 10:45:29 +03:00
|
|
|
|
2019-08-09 12:13:37 +03:00
|
|
|
* - ``--live-queries-multiplexed-refetch-interval``
|
2019-05-07 15:21:37 +03:00
|
|
|
- ``HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_REFETCH_INTERVAL``
|
2019-09-11 10:17:14 +03:00
|
|
|
- Updated results (if any) will be sent at most once in this interval (in milliseconds) for live queries
|
2019-05-16 10:45:29 +03:00
|
|
|
which can be multiplexed. Default: 1000 (1sec)
|
|
|
|
|
2019-08-09 12:13:37 +03:00
|
|
|
* - ``--live-queries-multiplexed-batch-size``
|
2019-05-07 15:21:37 +03:00
|
|
|
- ``HASURA_GRAPHQL_LIVE_QUERIES_MULTIPLEXED_BATCH_SIZE``
|
2019-09-19 15:54:40 +03:00
|
|
|
- Multiplexed live queries are split into batches of the specified size. Default: 100
|
2019-05-16 10:45:29 +03:00
|
|
|
|
2019-08-09 12:13:37 +03:00
|
|
|
* - ``--enable-allowlist``
|
2019-05-16 09:13:25 +03:00
|
|
|
- ``HASURA_GRAPHQL_ENABLE_ALLOWLIST``
|
2019-09-11 10:17:14 +03:00
|
|
|
- Restrict queries allowed to be executed by the GraphQL engine to those that are part of the configured
|
|
|
|
allow-list. Default: ``false`` *(Available for versions > v1.0.0-beta.1)*
|
2019-09-19 15:54:40 +03:00
|
|
|
|
2019-08-09 12:13:37 +03:00
|
|
|
* - ``--console-assets-dir``
|
2019-05-16 10:45:29 +03:00
|
|
|
- ``HASURA_GRAPHQL_CONSOLE_ASSETS_DIR``
|
|
|
|
- Set the value to ``/srv/console-assets`` for the console to load assets from the server itself
|
2019-09-11 10:17:14 +03:00
|
|
|
instead of CDN *(Available for versions > v1.0.0-beta.1)*
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-08-09 12:13:37 +03:00
|
|
|
* - ``--enabled-log-types``
|
2019-07-11 08:37:06 +03:00
|
|
|
- ``HASURA_GRAPHQL_ENABLED_LOG_TYPES``
|
|
|
|
- Set the enabled log types. This is a comma-separated list of log-types to
|
|
|
|
enable. Default: ``startup, http-log, webhook-log, websocket-log``. See
|
|
|
|
:ref:`log types <log-types>` for more details.
|
|
|
|
|
2019-08-09 12:13:37 +03:00
|
|
|
* - ``--log-level``
|
2019-07-11 08:37:06 +03:00
|
|
|
- ``HASURA_GRAPHQL_LOG_LEVEL``
|
|
|
|
- Set the logging level. Default: ``info``. Options: ``debug``, ``info``,
|
|
|
|
``warn``, ``error``.
|
|
|
|
|
2020-04-24 10:55:51 +03:00
|
|
|
* - ``--dev-mode``
|
|
|
|
- ``HASURA_GRAPHQL_DEV_MODE``
|
|
|
|
- Set dev mode for GraphQL requests; include the ``internal`` key in the errors extensions of the response (if required).
|
|
|
|
|
|
|
|
* - ``--admin-internal-errors``
|
|
|
|
- ``HASURA_GRAPHQL_ADMIN_INTERNAL_ERRORS``
|
|
|
|
- Include the ``internal`` key in the errors extensions of the response for GraphQL requests with the admin role (if required).
|
|
|
|
|
2020-12-21 12:11:37 +03:00
|
|
|
* - ``--enable-remote-schema-permissions``
|
|
|
|
- ``HASURA_GRAPHQL_ENABLE_REMOTE_SCHEMA_PERMISSIONS``
|
|
|
|
- Enable remote schema permissions (default: ``false``)
|
|
|
|
|
2021-01-29 08:48:17 +03:00
|
|
|
* - ``--infer-function-permissions``
|
|
|
|
- ``HASURA_GRAPHQL_INFER_FUNCTION_PERMISSIONS``
|
|
|
|
- When the ``--infer-function-permissions`` flag is set to ``false``, a function ``f``, stable, immutable or volatile is
|
|
|
|
only exposed for a role ``r`` if there is a permission defined on the function ``f`` for the role ``r``, creating a
|
|
|
|
function permission will only be allowed if there is a select permission on the table type.
|
|
|
|
|
|
|
|
When the ``--infer-function-permissions`` flag is set to ``true`` or the flag is omitted (defaults to ``true``), the
|
|
|
|
permission of the function is inferred from the select permissions from the target table of the function, only for
|
|
|
|
stable/immutable functions. Volatile functions are not exposed to any of the roles in this case.
|
|
|
|
|
2021-03-04 22:20:19 +03:00
|
|
|
*(Available for versions > v2.0.0)*
|
2021-02-23 15:00:19 +03:00
|
|
|
|
2021-04-29 01:26:32 +03:00
|
|
|
* - ``--schema-sync-poll-interval``
|
|
|
|
- ``HASURA_GRAPHQL_SCHEMA_SYNC_POLL_INTERVAL``
|
|
|
|
- Interval to poll metadata storage for updates in milliseconds - Default 1000 (1s) - Set to 0 to disable.
|
|
|
|
|
2021-03-11 18:20:42 +03:00
|
|
|
* - ``--experimental-features``
|
|
|
|
- ``HASURA_GRAPHQL_EXPERIMENTAL_FEATURES``
|
|
|
|
- List of experimental features to be enabled. A comma separated value is expected. Options: ``inherited_roles``.
|
|
|
|
|
2021-05-14 12:38:37 +03:00
|
|
|
* - ``--graceful-shutdown-timeout``
|
|
|
|
- ``HASURA_GRAPHQL_GRACEFUL_SHUTDOWN_TIMEOUT``
|
|
|
|
- Timeout (in seconds) to wait for the in-flight events (event triggers and scheduled triggers) and async actions to complete before the
|
|
|
|
server shuts down completely (default: 60 seconds). If the in-flight events are not completed within the
|
|
|
|
timeout, those events are marked as pending.
|
|
|
|
|
2019-02-14 08:58:38 +03:00
|
|
|
.. note::
|
2019-03-13 13:04:40 +03:00
|
|
|
|
|
|
|
When the equivalent flags for environment variables are used, the flags will take precedence.
|