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

config/environment.rb not requiring initializers nor files in load paths #695

beauby opened this Issue Dec 14, 2016 · 4 comments


None yet
3 participants

beauby commented Dec 14, 2016

While setting up hanami + sidekiq, I came across two hurdles:

  • requiring config/environment.rb does not load initializers (which may or may not be the right thing to do, but since sidekiq does not boot the app, but simply requires that file, it forces one to require the sidekiq config directly from config/environment)
  • requiring config/environment.rb does not load files in the load paths declared within apps.

@jodosha Any thoughts on this?


This comment has been minimized.


jodosha commented Dec 17, 2016

@beauby It's by design. Boot process happens when Hanami.boot is invoked.

What's your configuration for Sidekiq? Can you please share? Thanks 😄


This comment has been minimized.

beauby commented Dec 17, 2016

@jodosha I run sidekiq via bundle exec sidekiq -C ./config/sidekiq.yml -r ./config/environment.rb.

The downside of the first point is that one cannot put their sidekiq configuration in an initializer (except if they choose to manually require it from a wrapper that requires config/environment.rb as well).

The downside of the second point is that if one stores their application-specific sidekiq workers in apps/bookshelf/workers/foo_worker.rb, those have to be explicitly required within a sidekiq wrapper as outlined above.


This comment has been minimized.


AlfonsoUceda commented Jan 21, 2017

Folks what do you think it would be a good solution?


This comment has been minimized.


jodosha commented Jan 22, 2017

I think we should generate a new file for that:

# config/boot.rb
require_relative './environment'

@jodosha jodosha self-assigned this Jan 22, 2017

@jodosha jodosha added the feature label Jan 22, 2017

@jodosha jodosha added this to the v1.0.0.beta1 milestone Jan 22, 2017

@jodosha jodosha removed their assignment Jan 22, 2017

@jodosha jodosha self-assigned this Jan 30, 2017

@jodosha jodosha closed this in #720 Jan 30, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment