confy v0.2.0 Confy.Schema View Source

Functions that can be used inside Confy.defconfig/2.

Link to this section Summary

Functions

Specifies a field that is part of the configuration struct.

Link to this section Functions

Link to this macro

field(name, parser, options \\ []) View Source (macro)

Specifies a field that is part of the configuration struct.

Can/should only be called inside a call to Confy.defconfig.

  • name should be an atom representing the field. It will also become the field name for the struct that is created.
  • parser should either be:

    • an arity-one function reference like &YourModule.some_type_parser/1.
    • An atom representing one of the common parser function names in Confy.Parsers like :integer, :string, :boolean or :term.

Supported field options are:

  • default:, supplies a default value to this field. If not set, the configuration field is set to be required.

You are highly encouraged to add a @documentation text above each and every field; these will be added to the configuration's module documentation.