elixir-toniq / vapor

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

Add plan behaviour #87

Closed keathley closed 4 years ago

keathley commented 4 years ago

This PR introduces a new behaviour. This behaviour allows modules to define their own configuration requirements like so:

defmodule MyModule do
  def config_plan do
    [
      %Env{},
    ]
  end
end

Vapor.load!([
  %Dotenv{},
  MyModule,
])

This is based on a pattern that we're already using at B/R. It also provides a path for adding a more ergonomic DSL for building configuration plans.