Ooba Elda
Ooba Elda

Reputation: 1672

Exclude application in a mix project from startup

I have a dependency that starts an application, but I only want to use its modules and don't want its supervisor running. How do I exclude it from startup?

I have not found anything related to this in mans for app.start, run or in Mix.Project module

Upvotes: 3

Views: 2075

Answers (2)

Sheharyar
Sheharyar

Reputation: 75740

Specifying runtime is usually the right approach for most applications:

{:some_dep, "~> 1.0.0", runtime: false}

This causes the application supervision tree of the dependency to not get started with the rest of your application. But this still allows you to manually start it during runtime if you desire.

When using app: false instead, the dependency's Application module isn't read at all so you can't even manually start it later.

Upvotes: 7

Ooba Elda
Ooba Elda

Reputation: 1672

Just found it in mix help deps

  • :app - when set to false, does not read the app file for this dependency. By default, the app file is read
  • :runtime - whether the dependency is part of runtime applications. Defaults to true which automatically adds the application to the list of apps that are started automatically and included in releases

Both of them work in my case, not sure what is the difference though.

Upvotes: 4

Related Questions