elixir-toniq / vapor

Runtime configuration system for Elixir
MIT License
596 stars 37 forks source link

Specify types in our configuration instead of when fetched. #43

Closed keathley closed 5 years ago

keathley commented 5 years ago

I've been thinking about this a bit and I think that we should consider requiring the types for a given value when we define the configuration instead of doing it on the fly each time. There are tradeoffs to this approach which I'll try to list here:

Personally I think the benefits greatly outweigh the costs here but I may be missing something. Interested to see what y'all think.

svan-jansson commented 5 years ago

It sounds interesting. Type assertions during startup could definitely be helpful. I also like the idea of slimming down the getter syntax :)

In regards of specifying the types: How would, for instance, Env.with_prefix("APP") be type notated?

keathley commented 5 years ago

I'm still trying to think through the api for this. I think part of the issue is that the specifications would have to be done per provider since each provider returns data in slightly different formats. I also don't know how this would work with something like the env providers with_prefix option. But perhaps its better to just be explicit over convenient in this case.