Skip to content

Commit

Permalink
Improve docs for password store with Docker (#1014)
Browse files Browse the repository at this point in the history
* Improve docs for password store with Docker

* Remove reference to thirdparty gist

* Add clarification about adding --live flag

* Add clarification around $command
  • Loading branch information
ianjabour-stripe committed Jan 4, 2023
1 parent 3e42171 commit 9a28efb
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,37 @@ docker run --rm -it stripe/stripe-cli version
stripe version x.y.z (beta)
```

**Passwod Store Setup on Linux Dockers**
**Password Store Setup with Docker**

While test mode doesn’t require password store, you will need to set it up if you wish to perform live mode requests.

> You can also make live mode requests on a per command basis by attaching the `--api-key` flag.
1. Create `entrypoint.sh`

```sh
#!/bin/sh
if ! [ -f ~/.gnupg/trustdb.gpg ] ; then
chmod 700 ~/.gnupg/
gpg --quick-generate-key <gpg-key-alias-name> # ie. gpg --quick-generate-key stripe-live
gpg --quick-generate-key stripe-live # This will generate a gpg key called "stripe-live"
fi
if ! [ -f ~/.password-store/.gpg-id ] ; then
pass init <gpg-key-alias-name> # ie. pass init stripe-live
pass init stripe-live # This will initialize a password store record named "stripe-live", using the gpg key above
pass insert stripe-live # This will insert value for the password store "stripe-live", which we will put Stripe Live Secret Key in
fi

string="$@"
liveflag="--live"

if [ -z "${string##*$liveflag*}" ] ;then
pass show default.live_mode_api_key >/dev/null
OPTS="--api-key $(pass show stripe-live)" # This will use the content of the password store "stripe-live" which was inserted in line 8
fi

/bin/stripe $@
#pass insert stripe-live
/bin/stripe $@ $OPTS
```

2. Create docker file `Dockerfile-cli`
2. Create a docker file `Dockerfile-cli`

```sh
FROM stripe/stripe-cli:vx.x.x
Expand All @@ -81,19 +87,19 @@ COPY ./entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
```

3. Build docker image
3. Build the docker image

```sh
docker build -t stripe-cli -f Dockerfile-cli .
```

4. Run docker image with pass volumes
4. Run the docker image with password volumes, replacing `$command` with the appropraite Stripe CLI command (i.e `customers list`)

```sh
docker run --rm -it -v stripe-config://root/.config/stripe/ -v stripe-gpg://root/.gnupg/ -v stripe-pass://root/.password-store/ stripe-cli $command
```
```

for more details on initializing password store with gpg key, see https://gist.github.com/flbuddymooreiv/a4f24da7e0c3552942ff
> For live mode requests append `--live` after `$command`.
### Without package managers

Expand Down

0 comments on commit 9a28efb

Please sign in to comment.