hanami.github.io icon indicating copy to clipboard operation
hanami.github.io copied to clipboard

Environment Variables guide

Open cllns opened this issue 9 years ago • 7 comments

Right now we use dotenv in development and test environments, but not production. This issue has effected several people in the chat.

We should consider adding a guide for Environment variables. Specifically, explain how they're set in development and test, as well as offer some suggestions for how to set them in production (heroku config:set,.env.production combined with an entry in .gitignore, or even .bashrc).

We can talk about SERVE_STATIC_ASSETS and APPNAME_SESSIONS_SECRET there too.

cllns avatar Oct 10 '16 21:10 cllns

Which section do you see that fitting best under in the Guide? Dotenv is easy enough but the SERVE_STATIC_ASSETS + heroku may be tricky for some.

vlad-at-work avatar Oct 18 '16 04:10 vlad-at-work

@cllns Please do 👍 Be sure to make clear the security concerns of having a .env file in source control.

jodosha avatar Oct 24 '16 07:10 jodosha

@jodosha why not add ^.env.production to the initially generated .gitignore?

schnittchen avatar Dec 05 '16 20:12 schnittchen

I noticed HANAMI_ENV is nowhere mentioned in the guides.

schnittchen avatar Dec 05 '16 20:12 schnittchen

I also had trouble finding documentation on HANAMI_ENV, took me some trial and error, especially when running database migrations for test environment.

I'd love to help documenting this, but similar to the comment by @vladdypwnz, I'm new to Hanami and not sure where a section on environment variables belongs in the Guides. If anyone could give some pointers, that would be great.

florish avatar Dec 12 '16 18:12 florish

@schnittchen

why not add ^.env.production to the initially generated .gitignore?

Because .env.production isn't generated by Hanami, and because for production env it MUST NOT be used. You should set env variables via your VPS/Cloud provider.

jodosha avatar Dec 21 '16 07:12 jodosha

@cllns I think this guide should be under Guides -> Projects section.

It should include the details mentioned in the comment above ☝️ and how to use Dotenv.

jodosha avatar Dec 21 '16 07:12 jodosha