bigcommerce / gruf

gRPC Ruby Framework
https://github.com/bigcommerce/gruf
MIT License
626 stars 73 forks source link

Support multiple controllers_paths #214

Open xanderman opened 5 days ago

xanderman commented 5 days ago

What? Why?

Organizing rpc controllers in a complex project, using Rails Engines or other organization tools, is currently only possible with hacks that require each controller, like Dir.glob("#{path_to_engine_rpc_controllers}/**/*.rb").each { |f| require f }. Doing that means losing all the benefits of controllers_path, like hot reloading. If controllers_path could be a list, Gruf could managing autoloading/reloading the controllers in the engine itself.

Ideally, Gruf.configure would be reentrant so that the engine could add the path in its initializers, but even if it has to be in the top-level initializer that would still be a big step up.