I worry a bit about the stability of Webmachine applications if the standard behavior were to monitor a file and to change the dispatch list whenever the file was noticed to be different. For instance, what if you saved the file in a text editor after making just some of your changes?
The dispatch list is currently changeable at runtime, it is just not conveniently exposed. The dispatch list term is stored in the dispatch_list application environment variable. See webmachine_mochiweb for how this is used and see wmtrace_resource:add_dispatch_rule/2 for an example of modifying the dispatch list of a live Webmachine server.
While I don't want to make the default behavior be to constantly monitor the file and auto-reload, it should not be too hard to expose a utility function that could be manually invoked to reload a dispatch.conf file.
Hi, Benoit. Your request reminded me of a behavior I enjoyed while using Erlyweb. If you're still looking for a solution, I have taken Justin's advice and checked a gen_server into my wmexamples repo. It's called 'dispatch_watcher', and it has a behavior something like the mochiweb reloader in that it checks priv/dispatch.conf for updates once per second, reloading when necessary (although, both the path and interval are configurable).
Maybe a candidate for future Webmachine inclusion? (I'd advise some testing first - "Works on my machine," is all I can guarantee right now.)