How to approach local development only storage?

ets
genserver
mix
Tags: #<Tag:0x00007fc830bc4698> #<Tag:0x00007fc830bc4558> #<Tag:0x00007fc830bc43f0>

#1

Hello,

I can’t quite figure out how to best do appropriate development-only permanent storage. I’m currently developing an Elixir app with OAuth and I need a place to store sensitive development-only access token(s). Normally these tokens would be held in a cache or GenServer state, but since during development things are changing and I need to keep on restarting my entire Elixir application this is not an option for me. Since this is development-only, the “priv” directory is also not an option. So where/how should I store the development-only “permanent” data? Am I approaching this the wrong way?

I want to minimize dev-only code in my application too. I’m not sure how to go about doing this without sprinkling the ocassional check for an env variable stored in config.exs. As far as I know there is no compile-time way of checking for this. I’m currently relying on Application.get_env (and storing Mix.env in config.exs).

I couldn’t quite find an appropriate thread for this so I apologize in advance if it’s been addressed before.

Thank you for your time.


#2

I’ve used direnv with a .gitignored .envrc file containing sensitive dev configuration.


#3

That’s a great tool for sensitive dev configuation! I was more curious if there was builtin logic with Mix.

Thanks!


#4

I guess the Phoenix prod.secrets.exs style could also be applied to dev too. Just a separate file included at the end of dev.exs