reevoo / samuel

That is a tasty pull request.
Other
4 stars 0 forks source link

Fetch production github key from ENV #20

Closed lpil closed 9 years ago

lpil commented 9 years ago

https://github.com/reevoo/samuel/issues/19

http://12factor.net/

lpil commented 9 years ago

Jonny says:

Can we get something .env-like?

Louis says:

What's the advantage of .env? I've not played with it.

jonnyarnold commented 9 years ago

In development I want to be able to run mix with the Github access token on my machine. Rather than do GITHUB_ACCESS_KEY=key-key-key mix, I want to just be able to run mix, specify my environment in a .env file, and go.

This becomes especially important when we get more environment variables.

lpil commented 9 years ago

I think there's an established way to do this sort of thing with OTP, but I'm not sure what it is yet. I don't think .env really fits in with OTP + mix, but I'm probably wrong.

A thread that might be interesting -> https://groups.google.com/forum/#!topic/elixir-lang-core/SLlJxiMa-7Q

https://github.com/avdi/dotenv_elixir

lpil commented 9 years ago
System.get_env("MY_VAR") || Application.get_env(:myapp, :my_var) || some_default

This looks sensible.

jonnyarnold commented 9 years ago

Looks like a macro to me ;)

lpil commented 9 years ago

Possibly. Happy to put this into master?

jonnyarnold commented 9 years ago

Yep, fire away.

lpil commented 9 years ago

Rebased it, but github didn't notice. Guess it's a bug on their end.