Looking for solutions to two minor annoyances with Phoenix

There are two minor annoyances with using Phoenix and I was wondering if there are any solutions.

The first is sourcing .env on start of a new session. I like to use a .env file to hold secrets however I hate sourcing .env every time I start a new session. Its a little issue but I was wondering if there is any way to source them automatically when starting the app?

The other issue is aliasing modules whenever I run the console. It would be nice to have some config where I can list all the modules that I want to be aliased automatically once the console is launched. Does this exist?

For your second problem, yes there is a built-in tool for that. Take a look at this link

2 Likes

You can checkout a few existing packages for sourcing env files. I don’t have experience with any of them but they claim to do what you want:

For aliasing, you can create a .iex.exs file in the root of your project, then list your aliases there. iex will execute this file when starting.

2 Likes

For your first Q, I think a shell tool like direnv might help…

1 Like

Thanks for the replies everyone.

1 Like