Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to read environment variables from outside the yml file? #3

Closed
n4cr opened this issue Jul 24, 2019 · 3 comments
Closed

Comments

@n4cr
Copy link

n4cr commented Jul 24, 2019

Hi and thanks for this library. I'm very interested but I have a need which I didn't see in the documentation.
I prefer not to commit my environment variables to the git repo and read them from a .env on the production machine. Would it be possible to read the environment from a file?

@vifreefly
Copy link
Owner

vifreefly commented Jul 24, 2019

Hi @n4cr !

Procsd ENV variables (inside procsd.yml file) should store only production-mode specific variables required for your application, like for example HOST, PORT, etc.

All other sensitive data should go inside .env file and it could be read by your application itself. For example for Ruby there is https://github.com/bkeepers/dotenv , for Python https://github.com/theskumar/python-dotenv and so on.

Once again, inside procsd.yml you should store variables which are only production mode specific. Everything else put inside .env file and read it from your application.

@vifreefly
Copy link
Owner

But, if you still want it, you can :)

Your .env file should be located in the same folder with procsd.yml. To use env variables from .env file inside procsd.yml use following syntax:

# .env

SOME_API_KEY="234rsfsdfw423rfes"
# procsd.yml

app: sample_app
environment:
  API_KEY: <%= ENV['SOME_API_KEY'] %>

@n4cr
Copy link
Author

n4cr commented Jul 24, 2019

Thanks @vifreefly for the response. The reason I asked for this was because foreman exports the .env into the Service file so then it is accessible through reading them from the environment variables. But I guess your point to read them directly from .env file stands. As well as your solution.
Great work. I'm investigating procsd and probably start using it.

@n4cr n4cr closed this as completed Jul 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants