-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for dotenv (Shell) #4922
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One nit below. Usage looks good, so LGTM otherwise!
test/fixtures/Shell/main.env
Outdated
@@ -0,0 +1,2 @@ | |||
# comment | |||
export KEY=${ENV} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to find sample files from "real" applications here instead of using fixture files? Fixture files are not used to train the Bayesian classifier, so I'd really prefer to avoid them as much as possible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pchaigno Ok, I'll add some!
Please, see the discussion the issue: #4873 |
To add some more fun, the Ruby library supports YAML-like variables: https://github.com/bkeepers/dotenv/blob/master/spec/fixtures/yaml.env |
Associate *.env, .env, .env.example and .flaskenv to Shell. Add samples: - .flaskenv from https://github.com/stripe/stripe-payments-demo/blob/70ba859bb68a650b35b6e85ddc889ad143055170/server/python/.flaskenv (MIT License) - .env.example from https://github.com/proasis/api-rest/blob/670123448b19229677f0710751b2ef4e808f9bd3/.env.example (MIT License) - .env from https://github.com/rabbitmq/tgir/blob/4299d2513dad4bbdae87b107c1f1ec0b14fc04a1/.env (Apache 2 License) - default.env from https://github.com/diegoalmesp/trello-eureka/blob/43a4488f6df50be2a17cd9495ce29de6e4192b14/client/default.env (MIT License)
Associate *.env, .env, .env.example and .flaskenv to Shell. Add samples: - .flaskenv from https://github.com/stripe/stripe-payments-demo/blob/70ba859bb68a650b35b6e85ddc889ad143055170/server/python/.flaskenv (MIT License) - .env.example from https://github.com/proasis/api-rest/blob/670123448b19229677f0710751b2ef4e808f9bd3/.env.example (MIT License) - .env from https://github.com/rabbitmq/tgir/blob/4299d2513dad4bbdae87b107c1f1ec0b14fc04a1/.env (Apache 2 License) - default.env from https://github.com/diegoalmesp/trello-eureka/blob/43a4488f6df50be2a17cd9495ce29de6e4192b14/client/default.env (MIT License) Co-authored-by: Colin Seymour <colin@github.com>
Fixes #4873
Add samples:
https://github.com/rabbitmq/tgir/blob/4299d2513dad4bbdae87b107c1f1ec0b14fc04a1/.env
(Apache 2 License)
https://github.com/diegoalmesp/trello-eureka/blob/43a4488f6df50be2a17cd9495ce29de6e4192b14/client/default.env
(MIT License)
Description
dotenv files is a convention to use a subset of shell (commonly known as dotenv) to setup an environment.
The modern convention probably originates from the Ruby world in 2012 (see bkeepers/dotenv) and the supported syntax is roughly the following (although packages for different languages may support a more limited subset):
Anyway, you may find lots of samples in the wild using full Bash syntax (see the links to GitHub Search below).
Checklist:
.env
: https://github.com/search?q=filename%3A.env.env.example
: https://github.com/search?q=filename%3A.env.example*.env
: https://github.com/search?q=extension%3A.env+%28port+OR+host+OR+path+OR+user+OR+pass+OR+export%29.flaskenv
: https://github.com/search?q=filename%3A.flaskenvI have included a real-world usage sample for all extensions added in this PR:(added 3 fixtures)You may find some counter-examples, but not with wide usage as far as I see:
Dockerfile.env
(Dockerfile): https://github.com/search?q=filename%3Adockerfile.envMake.env
(Makefile): https://github.com/search?q=filename%3Amake.env&type=Code