I was wondering if there was a way in development to invoke something like mix phx.server --no-watch which I could somehow in dev.exs remove (or set to an empty list) my watchers. Many times I just want to boot my endpoint (so I can test my Absinthe GraphiQL API or run introspection queries) without firing off needless or (temporarily) erroring asset/webpack compilation.
I thought about this for quite a while and I’m not sure it’s possible… I think Mix.Tasks.Run --config can be passed a custom configuration file but not sure how to merge that config with my existing dev.exs.
You don’t need to duplicate common configuration since it’s always being merged for the same keys. So this would return the same final configuration as yours:
I spent a lot of time trying to call functions from a config kwlist and trying to figure out how to bring custom command line switches into scope in dev.exs when all I had to do was read from the global env var then merge the watcher into the endpoint config!
I’m sure your method defining a new environment would have worked @kokolegorille but I didn’t test as the other way is simpler.