From 6bb2de8e709436a0220bacedfc8a8b00ab2971c1 Mon Sep 17 00:00:00 2001 From: Scott Gerring Date: Sat, 11 Feb 2023 14:40:54 +0100 Subject: [PATCH] Clean up init process a little --- README.md | 12 +++++++++--- fetch/.gitignore | 2 -- fetch/fetch.sh | 3 +++ fetch/test.sh | 21 +++++++++++++++++++++ 4 files changed, 33 insertions(+), 5 deletions(-) create mode 100755 fetch/test.sh diff --git a/README.md b/README.md index 23fe944..8bc1f76 100644 --- a/README.md +++ b/README.md @@ -64,11 +64,17 @@ EOF # Create a secret for the mapbox credentials kubectl -n stravad create secret generic mapbox-credentials --from-env-file=frontend/.env +# Fetch a refresh token for strava. You'll need to plug +# the response in further down! +export STRAVA_CLIENT_ID=123 +export STRAVA_CLIENT_SECRET=00aabbccddee +ruby fetch/fetchAccessToken.rb + # Create an `env.sh` in `fetch` to specify strava access credentials: cat > fetch/env.sh << EOF -STRAVA_CLIENT_ID="2345 -STRAVA_CLIENT_SECRET="00aabbccddee" -STRAVA_REFRESH_TOKEN="eeffaabbccdd" +STRAVA_CLIENT_ID=$STRAVA_CLIENT_ID +STRAVA_CLIENT_SECRET=$STRAVA_CLIENT_SECRET +STRAVA_REFRESH_TOKEN=eeffaabbccdd EOF # Create the namespace diff --git a/fetch/.gitignore b/fetch/.gitignore index 91f7c1b..7708b89 100644 --- a/fetch/.gitignore +++ b/fetch/.gitignore @@ -1,4 +1,2 @@ env.sh -test.sh -testdata testdata-complete diff --git a/fetch/fetch.sh b/fetch/fetch.sh index bfbded2..c98d059 100755 --- a/fetch/fetch.sh +++ b/fetch/fetch.sh @@ -1,6 +1,9 @@ #!/bin/bash set -e +set -a + +source ./env.sh TARGET_DIR=/tiles/ diff --git a/fetch/test.sh b/fetch/test.sh new file mode 100755 index 0000000..5b7717a --- /dev/null +++ b/fetch/test.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +set -e +set -a + +source ./env.sh + +docker build . -t stravad-fetch + +docker run \ + --rm \ + -it \ + --name devtest \ + -e MAPBOX_ACCESS_TOKEN \ + -e MAPBOX_MAP_ID \ + -e STRAVA_CLIENT_ID \ + -e STRAVA_CLIENT_SECRET \ + -e STRAVA_REFRESH_TOKEN \ + --mount type=bind,source="$(pwd)"/testdata/,target=/tiles/ \ + ghcr.io/scottgerring/stravad-scrape:v0.0.3 + #stravad-fetch