Hi, I have mix project myapp that uses another mix project as dep:
defp deps do
[
{:distillery, "~> 2.1"},
{:mylib, path: "../mylib", runtime: false}
]
end
Because mylib itself is a Rest endpoint to CRUD db models, so I don’t want to start it with myap, hence the runtime: false.
Problem: mylib contains modules that to be used in myapp. But with runtime: false option, I get ...module undefined error... when using them. When set runtime: true, everything is fine.
So, how do I not start mylib with myapp but can still use its modules in runtime?
Extract those functions into a library that is used by myapp and mylib, or make mylib configurable to not start its REST endpoint when something in the appenv is “false”.
runtime: false means to not include the dependency into a release, nor does mix add the libraries location to the “search path” of the running application, I think it even explicitely unloads it after compilation phase.
Then I guess the solution would be to specify applications instead of extra_applications ? I believe this is configurable (but you would need to write all required applications in there).
Because that seems it should be something very easy to do : I have this dep, I need some code from it but I do not want to start its supervision, as I know the code that I will use will not require some processes to be up. Edit: And now I know, thanks.
That is true though, I agree it is the best solution in the long term.