distillery v2.0.8 Mix.Releases.Config.Provider behaviour View Source
This defines the behaviour for custom configuration providers.
Link to this section Summary
Functions
Given a file path, this function expands it to an absolute path, while also expanding any environment variable references in the path
Callbacks
Called when the provider is initialized
Link to this section Functions
Given a file path, this function expands it to an absolute path, while also expanding any environment variable references in the path.
Examples
iex> var = String.replace("Elixir.Mix.Releases.Config.Provider", ".", "_")
...> System.put_env(var, "hello")
...> {:ok, "var/hello/test"} = Elixir.Mix.Releases.Config.Provider.expand_path("var/${" <> var <> "}/test")
iex> {:ok, "/" <> _} = Elixir.Mix.Releases.Config.Provider.expand_path("~/")
iex> {:error, :unclosed_var_expansion} = Elixir.Mix.Releases.Config.Provider.expand_path("var/${FOO/test")
Link to this section Callbacks
Called when the provider is initialized.
Providers are invoked pre-boot, in a dedicated VM, with all application code loaded,
and kernel, stdlib, compiler, and elixir applications started. Providers must use
this callback to push configuration into the application environment, which will be
persisted to a final sys.config
for the release itself.
The arguments given to init/1
are the same as given in the config_providers
setting in
your release configuration file.