-
Notifications
You must be signed in to change notification settings - Fork 34
Support environment variables via dotenv in development #84
Comments
A quick point of clarification: environment variables are supported in development, the issue is with how dotenv loads them. Dotenv loads the environment variables in your https://github.com/bkeepers/dotenv/blob/master/lib/dotenv/railtie.rb So your If our railtie runs before the dotenv railtie the librato-rails configuration is built before your env vars are available for use. Unfortunately we need to do this early (before the rails initializers run) to ensure that we're available for certain types of instrumentation during rails startup/initialization. Most of the things you would configure with env vars check them in rails initializers or later, so dotenv works fine for them. I don't know that there is an easy fix for this, unfortunately. Have you considered using something like foreman to manage sourcing in the environment before you start the app in development? It basically uses the same convention, a |
Thanks for the quick & thorough response. In that case, I think the easiest fix is to add a note to readme regarding dotenv. |
Yeah, I guess the question is is this resolvable and if not which side it should be documented on. @bkeepers, any advice/thoughts on this? |
See the note on https://github.com/bkeepers/dotenv#rails
Does that fix it for you? |
@bkeepers It doesn't appear to help. If I remove my librato.yml and specify them in Happy enough using the YML file, it just was confusing to setup. |
I think this behaviour is because |
I haven't used Rails in a few years now. Feel free to close this issue if it's no longer relevant. |
We usually use dotenv 0.10 to configure environment variables via an .env.development file.
I get no librato-rails logging or metrics sent in the following situations:
It only works with librato.yml with the token and email under the development section in that file.
Verified that dotenv environment variables are available when running rails c.
The text was updated successfully, but these errors were encountered: