Skip to content
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

Proposal: Support for loading .env files #2332

Closed
fgrehm opened this issue Oct 5, 2013 · 3 comments
Closed

Proposal: Support for loading .env files #2332

fgrehm opened this issue Oct 5, 2013 · 3 comments

Comments

@fgrehm
Copy link
Contributor

fgrehm commented Oct 5, 2013

I've started to notice that a lot of people have been using environmental variables to make Vagrantfiles more dynamic so I was wondering if it would make sense to have this bundled on Vagrant's core instead of making a separate plugin for it.

As an example of usage, you can check Docker's Vagrantfile as they've been using it for setting things like base boxes names / URLs.

@mitchellh I did some testing with dotenv and it can give us a nice head start as it would be as simple as a adding a Dotenv.load during Vagrant's loading process:

$ vagrant plugin install dotenv
$ echo 'BOX_NAME=foo-bar' > .env
$ cat <<STR > Vagrantfile
Dotenv.load
puts "BOX_NAME is set to #{ENV['BOX_NAME']}"
STR
$ vagrant status
# outputs "BOX_NAME is set to foo-bar"

WDYT?

@fgrehm
Copy link
Contributor Author

fgrehm commented Oct 5, 2013

Oh, I'd just suggest that we default to give preference to a .vagrant.env in favor of .env as some people might depend on a .env for foreman and it could confuse some folks ;)

@mitchellh
Copy link
Contributor

I'm not a big fan of this. I think instead what I want to introduce is the concept of user variables within Vagrant just like Packer.

@fgrehm
Copy link
Contributor Author

fgrehm commented Oct 5, 2013

Oh, that's fancy! I haven't used Packer's user variables before, I'm playing with Packer as of this writing and will see if I can think of something for Vagrant :)

@hashicorp hashicorp locked and limited conversation to collaborators Apr 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants