As the doc suggests, in release, -mode embedded
option is passed to VM only when start|daemon|install
commands.
I see that eval
is for executing small piece of code in the same environment of deployed release, so loading all module is not always required.
However, in some cases we do want to load modules before executing code. For example in our situation, we want to run master-data population script using eval
. In that code we are using a bit of runtime reflection to conveniently enumerate existing Ecto.Schema
models, originating from :code.all_loaded()
and filtering them by checking reflection functions such as __schema__/1
.
So my question is:
- Is it currently possible to “eval” with
-mode embedded
? - If not, what should be the workaround? Including:
- Another module preloading technique, or,
- Nicer approach to enumerate particular type of modules, in release-compatible way
Thanks in advance!