2018-09-11 14:11:24 +03:00
|
|
|
Securing the GraphQL endpoint (Docker)
|
|
|
|
======================================
|
|
|
|
|
2018-12-03 15:12:24 +03:00
|
|
|
.. contents:: Table of contents
|
|
|
|
:backlinks: none
|
|
|
|
:depth: 1
|
|
|
|
:local:
|
|
|
|
|
2018-09-11 14:11:24 +03:00
|
|
|
To make sure that your GraphQL endpoint and the Hasura console are not publicly accessible, you need to
|
2019-02-14 12:37:47 +03:00
|
|
|
configure an admin secret key.
|
2018-09-11 14:11:24 +03:00
|
|
|
|
2019-02-14 12:37:47 +03:00
|
|
|
Run the docker command with an admin-secret env var
|
|
|
|
---------------------------------------------------
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
.. code-block:: bash
|
2018-11-23 12:17:31 +03:00
|
|
|
:emphasize-lines: 5
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
#! /bin/bash
|
2018-11-23 12:17:31 +03:00
|
|
|
docker run -d -p 8080:8080 \
|
|
|
|
-e HASURA_GRAPHQL_DATABASE_URL=postgres://username:password@hostname:port/dbname \
|
|
|
|
-e HASURA_GRAPHQL_ENABLE_CONSOLE=true \
|
2019-02-14 12:37:47 +03:00
|
|
|
-e HASURA_GRAPHQL_ADMIN_SECRET=myadminsecretkey \
|
2018-11-23 12:17:31 +03:00
|
|
|
hasura/graphql-engine:latest
|
2018-09-11 14:11:24 +03:00
|
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
2019-02-06 09:39:36 +03:00
|
|
|
If you're looking at adding access control rules for your data to your GraphQL API then head
|
|
|
|
to :doc:`Authentication / access control <../auth/index>`.
|