Dragonite.Config (Dragonite v0.1.1) View Source

Dragonite.Config is used to handle the config for rules in a runtime environment allowing reload or get the rules.

To configure the rules:

config :dragonite, rules_file: "./rules.yml"

The rules have a defined structure and must be placed into an available directory, please check priv directory to know how config for YML is used, the next is a single example of how YML structure works:

- isa:
   04: "$edi_customer.edi_provider_id" ### ISA at position 04 MUST match with edi_provider_id value at database
   05: "08" ### ISA at position 05 MUST match 08 string.
   06:
       - {el: "gs", value: "02"} ### ISA at position 05 MUST have same value in GS at position 02
   15:
       - "P" ### ISA at position 15 MUST match P or T string, other value is not valid.
       - "T"
   16:
       - {el: "st", value: "$length"} ### ISA at position 16 should contains the length of ST elements, if ST elements are 6 this position MUST have 6.

The above structure is translated to a single list and can be used to perform validations over an EDI message.

The newly added wildcard with database works only with edi_customer reference, because this info collects from the parsing event and can be translated to rules.

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Reloads the rules file and store the new rules in runtime.

Returns the rules already loaded.

Returns the rules already loaded for a specific type.

Returns the file config used for rules in the environment.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Specs

reload() :: :ok

Reloads the rules file and store the new rules in runtime.

Example

iex(1)> Dragonite.Config.reload()

Specs

rules() :: list()

Returns the rules already loaded.

Example

iex(1)> Dragonite.Config.rules()

Specs

rules(integer()) :: list()

Returns the rules already loaded for a specific type.

Example

iex(1)> Dragonite.Config.rules(204)

Returns the file config used for rules in the environment.