I currently have the issue of needing to provide an application with atoms, integers, booleans, and strings through environment variables so the application remains environment-agnostic and we can supply it config at boot time. But the problem is environment variables only support strings. So I’d like to do some coercion when we retrieve the variable, but I don’t see an easy way to use a module from the application inside of prod.exs, or config.exs. Does anyone have a way around this or a better way of handling this kind of configuration?
Yeah that’s similar to what we have been doing, but it doesn’t work well for booleans. But it does get the job done. I guess I’m trying to do something a little more elegant and were working towards using releases, but right now just need the application to be more config agnostic for our kubernetes deployments. I’m looking at using TOML or the config.exs provider options for distillery 2.0 which might be the only solution to the issue we are having. Thanks for replying I appreciate it.
was not aware that :true == true that’s interesting. I know some atoms were synonymous with certain things but I wasn’t aware those were one of them. So that’s awesome to know.
and yeah toml was something I was looking into. It seems like a decent solution. Although looks like I will need to write a custom transformer to handle atom conversions, which shouldn’t be too terrible. Unless I am completely misunderstanding those docs.
It’s not that they are synonyms, true quite literally is the atom :true, just that elixir lets you leave the : off on it, same with :false == false and :nil == nil. In erlang you just use atoms for all that (which is any word that starts with a lowercase or is surrounded by ''s).