Is there something similar to Rails.root for Phoenix. Lets say I'd like to work with a configuration file in a Phoenix app. What is the convention for finding the file and path for use in a script?
In case of Elixir this is not that easy as with Ruby, because your application is compiled - the compiled code resides in a different place than the source code.
The traditional place to put any additional resources for an Elixir/Erlang application is the priv directory alongside lib. Mix knows how to handle it, and expose it for the compiled code.
You can access it at runtime either with :code.priv_dir(my_app) or with Application.app_dir(my_app, "priv").
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With