From 0fb8e7723a31220ee9dd6d63477ab61ce0a810d4 Mon Sep 17 00:00:00 2001 From: Louis Garman <75728+leg100@users.noreply.github.com> Date: Fri, 4 Oct 2019 12:28:53 +0100 Subject: [PATCH] Disable caching --- README.md | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index b803946..1ba70f2 100644 --- a/README.md +++ b/README.md @@ -18,12 +18,15 @@ Next enable anyone on the internet to be able to read the badges (necessary if y gsutil defacl ch -u AllUsers:R gs://${GOOGLE_CLOUD_PROJECT}-badges/ ``` -Then upload the pre-generated badges in `./badges` to the bucket (ensure they go into a directory on the bucket named `badges/`): +Then upload the pre-generated badges in `./badges` to the bucket. Ensure they go into a directory on the bucket named `badges/`. Disable caching to ensure the latest updates to a badge are visible to end-users. ```bash -gsutil -m cp ./badges/*.svg gs://${GOOGLE_CLOUD_PROJECT}-badges/badges/ +gsutil -m -h "Cache-Control:no-cache,max-age=0" \ + cp ./badges/*.svg gs://${GOOGLE_CLOUD_PROJECT}-badges/badges/ ``` +Note: the `-m` flag uploads the badges in parallel, speeding it up. + ### Configure IAM Create a new service account for use by the Cloud Function: @@ -64,4 +67,4 @@ Ensure the following environment variables are set first: * `BADGES_BUCKET`: the name of the bucket containing the badges -You'll also need to install [jq](https://stedolan.github.io/jq/) and [xq](https://github.com/jeffbr13/xq). \ No newline at end of file +You'll also need to install [jq](https://stedolan.github.io/jq/) and [xq](https://github.com/jeffbr13/xq).