Understanding Elixir configs

This is something that is a little confuse to me and I keep reading on the internet about it but I don’t get it.

  • When should I use :build_embedded key on my mix.exs? Wouldn’t make sense to be always embedded for any project once it goes into production? When I use mix new it doesn’t include this either just module or --sup

    • Why start permanent when I dont have any supervisor or something like that?
  • Do I need :start_permanent if I am not creating any OTP package (I don’t have any Supervisor)? Like it is just module code like https://github.com/ueberauth/guardian_db

Site note, when I do mix new I see start_permanent: Mix.env == :prod even when it is a simple module, but again no clue why wouldn’t I do that. Normally the responsibility to handle crashing is delegated to the higher OTP app right?!

2 Likes

:build_embedded will copy the assets to _build for easy distribution, otherwise they are symlinked.

Don’t, if you don’t run any actors then you are just a library module and do not nor should not have a top application. :slight_smile:

If you have no application in your project, then I don’t think :start_permanent does anything. (?)

Because in dev if it dies you may not want it to restart endlessly. :slight_smile:

An Application ‘is’ the highest OTP applications. They are roughly equal on the BEAM ‘OS’. (roughly)

2 Likes

Super mega clear your explanation about it! This explanation should be on the main website some how, I really didn’t get the ones out there (probably I am dumb).

Makes sense about having the start_permanent all the time for development.

Thanks a lot!

2 Likes