-
Notifications
You must be signed in to change notification settings - Fork 13
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
Fix Railtie / Rails initializers #24
Conversation
…don't log if logger is nil
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this PR. I left a few thoughts.
Can I ask why |
Don't merge yet, I found a small problem with this! |
Delegating (Edit: or, rather than removing, we could define it directly and allow it to set a new logger for just Webvalve) |
yea, i don't think i thought that one through enough. the fancy logger stuff that's going on here is meant to allow for use of Rails.logger when this library is used with Rails and a default logger or custom logger when used with any other framework. |
This part of the code is not covered by the specs and I don't know yet how to test this using a real Rails application. The dummy project in |
Should |
i believe the there's an example sinatra app in the examples directory that can be used to verify that we didn't break anything there.
yea. let's do that. |
@samandmoore is this OK now? |
looks good. thank you for the submission. /domain @samandmoore |
Approved! 🙌 👻 💫 |
@haffla i will look into releasing a new version tomorrow. thanks again. |
@haffla took a bit longer than expected, but v0.9.7 is released! thanks again. |
Thanks a lot for your support! |
Hello! First of all thanks for this gem.
I've noticed a problem with the Railtie initializers.
WebValve.enabled?
is called inside theRailtie
class. The problem with this is that user defined environment variables such asWEBVALVE_ENABLED
might not be set when this class is loaded. This is true for users of Figaro or users who dynamically set env vars in an initializer or config file. So the call toenabled?
should be inside the initializers.Moreover
Rails.logger
(which might be used inenabled?
is not initialized at this point. It is actually not initialized whenwebvalve.set_autoload_paths
runs. To solve this I added the safe navigation operator inenabled?
.