Skip to content
This repository has been archived by the owner on Feb 24, 2024. It is now read-only.

Adds dot env support #792

Merged
merged 8 commits into from
Dec 21, 2017
Merged

Adds dot env support #792

merged 8 commits into from
Dec 21, 2017

Conversation

paganotoni
Copy link
Member

@paganotoni paganotoni commented Dec 14, 2017

This PR adds .env support for generated buffalo apps, when generating a new buffalo app this adds an empty .env file, adds that file to the .gitignore and uses envy.Load() to load the .env every time the application restarts.

This PR also adds .env to the list of extensions that will be listened by refresh to restart the app, this is because it is cool to have the env change applied without stopping buffalo dev.

This is related with #606

@paganotoni paganotoni changed the title Feature/add dot env support WIP: Adds dot env support Dec 14, 2017
…main func, also adding .env in the list of refreshables extensions
@paganotoni paganotoni changed the title WIP: Adds dot env support Adds dot env support Dec 14, 2017
@paganotoni paganotoni requested a review from markbates December 14, 2017 15:39
@paganotoni paganotoni mentioned this pull request Dec 15, 2017
Copy link
Member

@markbates markbates left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps generate a new .env file for new projects, with comments inside as to how .env works, the layout of the file, etc...

Currently, I don't know how that file works, so if I don't understand it, it's going to be hard for others. :)

@@ -34,6 +34,9 @@ var T *i18n.Translator
// should be defined. This is the nerve center of your
// application.
func App() *buffalo.App {
//Loading .env file values
envy.Load()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this into buffalo.New that way it'll just work for every app, and they don't need the extra line. Check to make sure that moving this doesn't cause any problems for older apps, as well as apps that don't have a .env.

@paganotoni
Copy link
Member Author

@markbates thanks for the feedback, I changed the eny.Load() to be done in the buffalo.New and added a short description in the generated .env

@paganotoni
Copy link
Member Author

@markbates what do you think about generating the SECRET_KEY on the .env by default ?

@markbates
Copy link
Member

I don't think it's good idea. In development that key doesn't really matter, it only matters in production. From my understanding of the .env file is that it's not supposed to be committed, but is for each developer to set up for their environment. If that is correct we should also add it to the default .gitignore

@paganotoni
Copy link
Member Author

Yes, it is ignored currently, right, was thinking developers to have environment as closer to production as possible, but you're right if it doesn't make a difference then I'll forget it 👍

@paganotoni
Copy link
Member Author

Also, let me know if there is something else to do on this one and I'll jump into it, thanks for all the feedback!

@markbates markbates merged commit fb92c0d into development Dec 21, 2017
@markbates markbates deleted the feature/add-dot-env-support branch December 21, 2017 16:58
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants