elixir-toniq / vapor

Runtime configuration system for Elixir
MIT License
592 stars 36 forks source link

Add casts and conversions #18

Closed keathley closed 5 years ago

keathley commented 5 years ago

This PR introduces additional cast options and allows the user to specify their own cast if need be. In order to implement this I've updated the semantics of get/2 and get!/2. I had mixed feelings about these changes but I think the new semantics provide the best tradeoffs.

get/2 now returns {:ok, term()} | {:error, Error}. get!/2 will raise errors if values can't be found or if they don't convert correctly. This may not be exactly the semantics we want long term but I think they're good enough for now.

keathley commented 5 years ago

@bgmarx Lemme know what you think