Skip to content

Commit 1717ca7

Browse files
committed
Document how to export CF service creds for the --no-dry-run path
1 parent e6f49cd commit 1717ca7

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

scripts/README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ Add `--no-dry-run` to actually trigger the jobs; that path also needs
4646
`CF_API_URL`, `CF_SERVICE_USER`, and `CF_SERVICE_AUTH` set, since it uses
4747
`CFHandler` to throttle against `HARVEST_RUNNER_MAX_TASKS`.
4848

49+
These are already set on the deployed app, so pull them from there instead of
50+
hunting for the underlying service account credentials. `cf env` prints them
51+
in two different shapes (`CF_API_URL` as a flat `KEY: value` line,
52+
`CF_SERVICE_USER`/`CF_SERVICE_AUTH` as quoted JSON fields), so a plain
53+
`grep`/`export` won't catch all three:
54+
55+
```bash
56+
eval "$(cf env datagov-harvest | grep -E '"?(CF_API_URL|CF_SERVICE_USER|CF_SERVICE_AUTH)"?:' | sed -E 's/^[[:space:]]*"?([A-Z_]+)"?:[[:space:]]*"?([^",]*)"?,?$/export \1="\2"/')"
57+
```
58+
4959
### Connecting to the prod database
5060

5161
cloud.gov databases aren't reachable directly from a local machine, so you

0 commit comments

Comments
 (0)