environment variables - How to update .env file and share among teammates? -
i created .env
file params, pushed github, teammates downloaded repo. in next push added .env
file .gitignore
. need make changes .env
file, how if .env
ignored. right way of doing such of manipulation?
you not store .env
in repo create .env.dist
(or named that) , put in project repository instead. such file template or example of how production .env
should , such stores keys, but no values, i.e.:
db_host= db_user=
the main benefit not have .env
in repo, each developer can setup own system likes/needs (i.e. local db, etc) , there's no risk of having such file accidentally overwritten on next pull, @ least frustrating. also, not store sensitive data in repository, noone can i.e. run code agains production machine.
depending on development environment use, can automate creation of .env
file, using provided .env.dist
template (whcih useful i.e. ci/cd servers). dotenv file pretty simple, processing easy. wrote such helper tool php myself, pretty simple code , can ported other language if needed. see process-dotenv on github reference.
Comments
Post a Comment