Configuration in .env file
Problem
What are you trying to do?
Run stripe cli in a project directory and use that project's current local configuration file, .env. Many other development cli tools I use do this by default (node, docker-compose, various IDE plugins, hasura, netlify)
This would provide convenience, consistency (with other similar cli tools), and a single location for sensitive values for a local project.
As a workaround, I put this bash in my .zshrc:
stripe() {
if [ -f .env ]; then
source .env
export STRIPE_API_KEY
fi
command stripe "$@"
}
Feature
What would help you accomplish your original task
The stripe-cli would read the .env file for the stripe API key, if it exists, from the current working directory, overriding the api key value in ~/.config/stripe/config.toml.
Examples
Any example interaction you expect
.env file in the the current working directory contains:
STRIPE_API_KEY=sk_test_09f4jr9843j409qhdfasd89
Running any stripe sub-command from the same directory uses the api key.
For security, I'd suggest to enforce the file not have global visibility (600 on Mac/Linux/WSL)
Thanks for the suggestion! This is a good idea, will see if we can do this.
I'd like to add that STRIPE_SECRET_KEY would be a better choice than STRIPE_API_KEY. The former is what's used by other tools and APIs.