-
Notifications
You must be signed in to change notification settings - Fork 76
Description
Please describe the issue
https://github.com/bigcommerce/gruf/blob/main/lib/gruf/integrations/rails/railtie.rb#L26
The above file adds an intializer which is invoked before_configuration. The initializer is supposed to modify the Rails autoloader and ignore Gruf.controllers_path from it.
But Gruf.controllers_path is supposed to be configured within an intializer. The before_configuration hook is too early in the life cycle, and at this stage none of the intializers are executed. So the above file always end up ignoring the default controllers_path from Rails autoloader.
Rails intializer hooks are:
- before_configuration
- before_initialize
- before_eager_load (only executed if eager_load=true)
- prepare_to (executed on each request in dev environment, executed once on boot in others)
- after_initialize
Instead of before_configuration I think this should depend on eager_load config. And it should be something like
if config.eager_load
before_eager_load { ..."setup the rails autoloader and eager load paths" }
else
after_initialize { ..."setup the rails autoloader and eager load paths" }
endHow to Reproduce
Steps to reproduce the behavior:
- Initialize new rails app
- Add gruf to it
- add gruf.rb to config/initializers
Gruf.configure do |c|
c.controllers_path = "app/my_custom_rpc_dir"
end- create app/my_custom_rpc_dir and add a Grpc service to it
- run
bundle exec gruf - see error regarding zietwerk conflict
What should happen?
bundle exec gruf should run successfully as the configuration is correct
Anything else we should know?
- gRPC version
- Ruby version
- OS
- Does it occur at certain traffic volumes, payload size, etc