1

I have the following docker-compose.yml file:

version: '3.6'

services:
    stripe-cli:
        image: stripe/stripe-cli:latest
        container_name: stripe-cli
        secrets:
            - StripeSecretKey
        environment:
            StripeSecretKey: /run/secrets/StripeSecretKey
        command: --api-key ${StripeSecretKey} listen --forward-to http://localhost:5000/api/payment/webhook
            
secrets:
    StripeSecretKey:
        file: ./secrets/StripeSecretKey.txt

The secret 'StripeSecretKey' points to a text file which has the secret key being:

enter image description here

I am trying to string interpolate my secret key value in the command argumant of the stripe-cli container. But I am unable to do so with the above syntax.

I am getting the following warning when executing the above docker-compose file:

WARNING: The StripeSecretKey variable is not set. Defaulting to a blank string.

I would appreciate the help.

1 Answer 1

1

Try like this

        environment:
            STRIPE_API_KEY: /run/secrets/StripeSecretKey
        command: listen --forward-to http://localhost:5000

https://stripe.com/docs/cli/api_keys You can set two environment variables, which take precedence over all other values:

STRIPE_API_KEY: the API key to use for the CLI.
STRIPE_DEVICE_NAME: the device name for the CLI, visible in the Dashboard.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.