From 4526ce0a9457670adbd527940765dede66fbef48 Mon Sep 17 00:00:00 2001 From: herecydev Date: Wed, 29 Jul 2020 17:28:12 +0100 Subject: [PATCH 1/5] Add refresh content docs --- docs/docs/environment-variables.md | 4 +--- docs/docs/refreshing-content.md | 13 +++++++++++++ www/src/data/sidebars/doc-links.yaml | 2 ++ 3 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 docs/docs/refreshing-content.md diff --git a/docs/docs/environment-variables.md b/docs/docs/environment-variables.md index c477add7bcbf0..d0b07a6560dc5 100644 --- a/docs/docs/environment-variables.md +++ b/docs/docs/environment-variables.md @@ -134,9 +134,7 @@ Gatsby also allows you to specify another environment variable when running the - `ENABLE_GATSBY_REFRESH_ENDPOINT` -If set to true, this will expose a `/__refresh` webhook that is able to receive `POST` requests to _refresh_ the sourced content. This exposed webhook can be triggered whenever remote data changes, which means you can update your data without re-launching the development server. - -You can trigger this endpoint locally, for example, on Unix-based operating systems (like Ubuntu and macOS) using `curl -X POST http://localhost:8000/__refresh`. +This allows you to refresh your sourced content. See [Refreshing content](/docs/content-and-data/refreshing-content). ## Build Variables diff --git a/docs/docs/refreshing-content.md b/docs/docs/refreshing-content.md new file mode 100644 index 0000000000000..01d05a1b35504 --- /dev/null +++ b/docs/docs/refreshing-content.md @@ -0,0 +1,13 @@ +--- +title: Refreshing Content +--- + +During local development it can be useful to refresh sourced content without restarting the development server. To faciliate this Gatsby exposes an environmental variable `ENABLE_GATSBY_REFRESH_ENDPOINT`. + +If set to true, this will expose a /\_\_refresh webhook that is able to receive POST requests to refresh the sourced content. This exposed webhook can be triggered whenever remote data changes. + +You can trigger this endpoint locally, for example, on Unix-based operating systems (like Ubuntu and macOS) using curl -X POST http://localhost:8000/__refresh. + +Additionally, the sourced content can also be refreshed through the GraphiQL explorer. + +Securing the refresh endpoint is possible by supplying a value for the environmental variable `GATSBY_REFRESH_TOKEN`, which will cause Gatsby to only accept requests with a matching authorization header. For example `GATSBY_REFRESH_TOKEN=12345` would require a request with header: `authorization: 12345`. diff --git a/www/src/data/sidebars/doc-links.yaml b/www/src/data/sidebars/doc-links.yaml index 77234f97d9772..51334bdc59c16 100644 --- a/www/src/data/sidebars/doc-links.yaml +++ b/www/src/data/sidebars/doc-links.yaml @@ -228,6 +228,8 @@ - title: Sourcing Content from JSON or YAML link: /docs/sourcing-content-from-json-or-yaml/ breadcrumbTitle: JSON or YAML + - title: Refreshing Content + link: /docs/refreshing-content/ - title: Querying Your Data with GraphQL link: /docs/graphql/ breadcrumbTitle: Querying with GraphQL From 15b7124f5d3575e0d1a7b8c82957804e16c90376 Mon Sep 17 00:00:00 2001 From: Dan Kirkham Date: Sat, 1 Aug 2020 12:34:07 +0100 Subject: [PATCH 2/5] Update docs/docs/refreshing-content.md Co-authored-by: Aisha Blake --- docs/docs/refreshing-content.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/refreshing-content.md b/docs/docs/refreshing-content.md index 01d05a1b35504..e94af6f0f69cd 100644 --- a/docs/docs/refreshing-content.md +++ b/docs/docs/refreshing-content.md @@ -2,7 +2,7 @@ title: Refreshing Content --- -During local development it can be useful to refresh sourced content without restarting the development server. To faciliate this Gatsby exposes an environmental variable `ENABLE_GATSBY_REFRESH_ENDPOINT`. +During local development, it can be useful to refresh sourced content without restarting the development server. To facilitate this, Gatsby exposes an environment variable called `ENABLE_GATSBY_REFRESH_ENDPOINT`. If set to true, this will expose a /\_\_refresh webhook that is able to receive POST requests to refresh the sourced content. This exposed webhook can be triggered whenever remote data changes. From 473f2eb80d56ca0be6195bbee3ce53d1bfbee268 Mon Sep 17 00:00:00 2001 From: Dan Kirkham Date: Sat, 1 Aug 2020 12:34:31 +0100 Subject: [PATCH 3/5] Update docs/docs/refreshing-content.md Co-authored-by: Aisha Blake --- docs/docs/refreshing-content.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/refreshing-content.md b/docs/docs/refreshing-content.md index e94af6f0f69cd..80ac3f2f788a1 100644 --- a/docs/docs/refreshing-content.md +++ b/docs/docs/refreshing-content.md @@ -4,7 +4,7 @@ title: Refreshing Content During local development, it can be useful to refresh sourced content without restarting the development server. To facilitate this, Gatsby exposes an environment variable called `ENABLE_GATSBY_REFRESH_ENDPOINT`. -If set to true, this will expose a /\_\_refresh webhook that is able to receive POST requests to refresh the sourced content. This exposed webhook can be triggered whenever remote data changes. +If set to `true`, this will expose a `/__refresh` webhook that can receive POST requests to refresh the sourced content. This exposed webhook can be triggered whenever remote data changes. You can trigger this endpoint locally, for example, on Unix-based operating systems (like Ubuntu and macOS) using curl -X POST http://localhost:8000/__refresh. From 7bb9418bd6a0b031450858576c34b8283521d5c3 Mon Sep 17 00:00:00 2001 From: Dan Kirkham Date: Sat, 1 Aug 2020 12:34:47 +0100 Subject: [PATCH 4/5] Update docs/docs/refreshing-content.md Co-authored-by: Aisha Blake --- docs/docs/refreshing-content.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/refreshing-content.md b/docs/docs/refreshing-content.md index 80ac3f2f788a1..a975078e594ff 100644 --- a/docs/docs/refreshing-content.md +++ b/docs/docs/refreshing-content.md @@ -6,7 +6,7 @@ During local development, it can be useful to refresh sourced content without re If set to `true`, this will expose a `/__refresh` webhook that can receive POST requests to refresh the sourced content. This exposed webhook can be triggered whenever remote data changes. -You can trigger this endpoint locally, for example, on Unix-based operating systems (like Ubuntu and macOS) using curl -X POST http://localhost:8000/__refresh. +You can trigger this endpoint locally, for example, on Unix-based operating systems (like Ubuntu and macOS) using `curl -X POST http://localhost:8000/__refresh`. Additionally, the sourced content can also be refreshed through the GraphiQL explorer. From 2898802144e50dd0656ab2ed86f049248298d73c Mon Sep 17 00:00:00 2001 From: Dan Kirkham Date: Sat, 1 Aug 2020 12:35:20 +0100 Subject: [PATCH 5/5] Update docs/docs/refreshing-content.md Co-authored-by: Aisha Blake --- docs/docs/refreshing-content.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/refreshing-content.md b/docs/docs/refreshing-content.md index a975078e594ff..0fda055445b34 100644 --- a/docs/docs/refreshing-content.md +++ b/docs/docs/refreshing-content.md @@ -8,6 +8,6 @@ If set to `true`, this will expose a `/__refresh` webhook that can receive POST You can trigger this endpoint locally, for example, on Unix-based operating systems (like Ubuntu and macOS) using `curl -X POST http://localhost:8000/__refresh`. -Additionally, the sourced content can also be refreshed through the GraphiQL explorer. +Additionally, the sourced content can also be refreshed with the "Refresh Data" button in the [GraphiQL explorer](/docs/running-queries-with-graphiql). This button is only visible if `ENABLE_GATSBY_REFRESH_ENDPOINT` is set to `true`. Securing the refresh endpoint is possible by supplying a value for the environmental variable `GATSBY_REFRESH_TOKEN`, which will cause Gatsby to only accept requests with a matching authorization header. For example `GATSBY_REFRESH_TOKEN=12345` would require a request with header: `authorization: 12345`.