hackoregon / transportation-system-backend

2018 repo for the transportation api backend
MIT License
8 stars 2 forks source link

Handling env variables #26

Closed BrianHGrant closed 6 years ago

BrianHGrant commented 6 years ago

So we have ran into issue with using the .env file in that the variables are only available inside the container not to the compose file itself. What is our best option to overcome?

There maybe a way to make them available in the compose file from the dotenv.

We can pass host env variables thrrough string interpolation, then revert back to the env.sh with export statements. Using the startup scripts would then handle the import. This is path we followed last year. It allows for encrypted variables to be set in the Travis build as well.

We also had a "project_config".py which handled all the settings.py config vars and was built locally andd also pulled in via a script in the production environment. This is the script that pulled it f or reference: https://github.com/hackoregon/backend-service-pattern/blob/master/bin/getconfig.sh

I am going to clarify on the need for this vs a single config file, maybe more pythonic🤘

znmeb commented 6 years ago

I posted this in Slack but here it is again ;-) https://vsupalov.com/docker-arg-env-variable-guide/. Either way, they may not be usable for secrets since they're stored in the image. But then nobody should be able to see our images except us.

znmeb commented 6 years ago

see issue #28

znmeb commented 6 years ago

I think we can close this - I have all the enviroment variable issues fixed in branch znmeb-merge-new-database

BrianHGrant commented 6 years ago

i would be ok with closing, with the merge of the PR. Use of the .env in its default also seems to allow for the setting of env variables if it is not there. So i believe this allows for variables to be set in travis, other environments. this would allow devops to manage any credentials in later environments as in:

https://github.com/hackoregon/civic-devops/issues/4

bhgrant8 commented 6 years ago

closing this issue as resloved with PR #32