[英]String Interpolate environment variable in docker-compose
我有以下 docker-compose.yml 文件:
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
秘密“StripeSecretKey”指向一个文本文件,其密钥为:
我正在尝试在 stripe-cli 容器的命令参数中对我的密钥值进行字符串插值。 但我无法使用上述语法这样做。
执行上述 docker-compose 文件时,我收到以下警告:
WARNING: The StripeSecretKey variable is not set. Defaulting to a blank string.
我将不胜感激。
像这样试试
environment:
STRIPE_API_KEY: /run/secrets/StripeSecretKey
command: listen --forward-to http://localhost:5000
https://stripe.com/docs/cli/api_keys您可以设置两个环境变量,它们优先于所有其他值:
STRIPE_API_KEY: the API key to use for the CLI.
STRIPE_DEVICE_NAME: the device name for the CLI, visible in the Dashboard.
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.