What I’ve done for this is create a small wrapper script around bin/myapp which does whatever is needed to set up the environment, and then runs exec bin/myapp "$@". In my case I was deploying via Docker so I could choose where to dump that script - if deploying via other means, you will have to handle deployment of your shim outside of Distillery, but that’s usually a trivial problem to solve.
The distribution configuration is required in order to manage the node, so deferring it to after boot is explicitly a non-goal at this time. Since one can execute code prior to boot, it’s trivial to execute arbitrary programs to do the heavy lifting to get that configuration in place anyway. That said, I recognize that currently Distillery has a gap here.
As for why Distillery doesn’t have a hook early in the boot process for this - it does have pre_configure, but that is executed after vm.args is injected with env vars, and that’s done because I’ve always felt that the base configuration needed to be in place before handing anything off to user scripts. In general it’s expected that required env vars for replacement are set before the release is booted - that said, clearly even I have needed to handle things earlier in the process, so I may change things such that pre_configure occurs before env var replacement - it’s technically a breaking change, but since it occurs very early in process, there is very little you can actually do anyway, and it was really intended for this kind of thing - I probably should provide an option to enable that behaviour and go through a deprecation cycle. I haven’t done that yet since it was trivial to work around in my case, so you could chalk it up to laziness .
Could you open an issue on the Distillery tracker? I’ll add it to my TODO for the next release.