elixir-toniq / vapor

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

Add better stacking of configuration #32

Closed keathley closed 5 years ago

keathley commented 5 years ago

This PR provides proper support for layering configuration values and should make it easier to build out some important features such as watching and rollbacks in the future.

I've created a new Configuration struct and module to provide all of the layering functionality. I think this is a terrible name so we should probably change it. The main role of Configuration is to hold onto a list of values that have been resolved from whatever provider. It can collapse these values into a list of keys which can then be easily loaded into an ets table. It can also maintain previous versions. Currently the versions are unused and only there for demonstration purposes. I suspect that realistically we'll want to use some sort of circular buffer or other bounded data structure to hold versions.

I've also created a Plan module for building up these configuration plans. Personally I find this to be a very shallow module but for some reason I felt compelled to keep those things separate for now. If anyone has better ideas here I'm happy to hear them.

Let me know what you think. @jeffweiss I know that you had some thoughts on this as well so let me know if this jives well with what you've been playing around with.

keathley commented 5 years ago

This is superseded by #33.