Hello everyone!
I have an application that defines a module callback in its mix.exs
’s application/0
function:
mix.exs:
def application do
[
mod: {MyApp.Application, []},
extra_applications: [:logger, :runtime_tools]
]
end
However, I would like the supervisor spawned by MyApp.Application
to only be started if my application is started as a “top-level” application in dev mode when running mix run
in the cloned application repository.
On the other hand, if my application is loaded as the dependency of another application, I don’t want the supervision tree to be spawned.
Is there any way to achieve this? Can MyApp.Application
find out or being told whether it’s being started as “top-level” app?
Thanks!