some releases ago it was possible to configure the source_dirs:
This possibility seems no longer available in this way. Does somebody know, how to achieve this with latest Hanami 2.x?
I want to add something like that:
config.component_dirs.add "app" do |dir|
dir.instance = proc do |component|
Removed in this PR. You can use
config.no_auto_register_paths or magic comments to exclude certain files.
You should still be able to configure component dirs, but inside a
The idea with
prepare_container is to give people a “use at your own risk” method for customising internal container config.
The block is run after Hanami has already configured its containers.
So you could try something like this:
class App < Hanami::App
prepare_container do |container|
# container is the Dry::System::Container for the app
# configure an automatically-configured dir like this
container.config.component_dirs.dir("some/dir") do |dir|
# configure the dir here
# or add your own
container.config.component_dirs.add "another/dir" do |dir|
# or do any other kind of config you want
@timriley Thank you. I’m still not used to the awesomeness that hanami offers. I’m still excited every day.