Lamina.DSL (lamina v0.4.0)

Defines the macros used for building a configuration module.

Link to this section Summary

Functions

Defines an individual configration parameter.

Defines an individual configration parameter.

Defines a provider for the configuration system.

Defines a provider for the configuration system.

Link to this section Functions

Link to this macro

config(config_key)

(macro)

Specs

config(Lamina.config_key()) :: Macro.t()

Defines an individual configration parameter.

The same as config/2, except that no block is provided.

Link to this macro

config(config_key, list)

(macro)

Specs

config(Lamina.config_key(), [{:do, Macro.t()}]) :: Macro.t()

Defines an individual configration parameter.

Arguments:

  • config_key - the name of the new configuration parameter to define.
  • block - a "do block" which will be evaluated in the context of the Lamina.DSL.Config module.

Example

config :listen_port do
  cast(&Lamina.Cast.to_integer/1)
  validate(&is_integer/1)
end
Link to this macro

provider(module)

(macro)

Specs

provider(module()) :: Macro.t()

Defines a provider for the configuration system.

The same as provider/2, however passes an empty list to the provider's init/1 function.

Link to this macro

provider(module, options)

(macro)

Specs

provider(module(), keyword()) :: Macro.t()

Defines a provider for the configuration system.

Arguments:

  • module - the name of a module which implements the Lamina.Provider behaviour.
  • options - a keyword list of options to be passed to the provider's init/1 function.

Example

provider(Lamina.Provider.Env, prefix: "HTTP")