elixir-toniq / vapor

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

Add group providers #62

Closed keathley closed 4 years ago

keathley commented 4 years ago

This PR introduces "group" functionality as a provider. This allows users to name sets of configuration which is useful to avoid duplication and avoids conflicts in common names such as "port" and "host.

Example

providers = [
  %Group{
    name: :primary_db,
    providers: [
      %Env{bindings: [port: "PRIMARY_DB_PORT", host: "PRIMARY_DB_HOST"]},
    ]
  },
  %Group{
    name: :redis,
    providers: [
      %Env{bindings: [port: "REDIS_PORT", host: "REDIS_HOST"]},
    ]
  },
]