Lightning.Config.Utils (Lightning v2.19.0-pre)

View Source

Utility functions for working with the application environment.

Summary

Functions

Retrieve a value nested in the application environment.

Parse a comma-separated list of hostnames into a normalised list.

Functions

ensure_boolean(value)

@spec ensure_boolean(binary()) :: boolean()

get_env(list, default \\ nil)

Retrieve a value nested in the application environment.

get_env(app, key, path, default \\ nil)

parse_host_list(value)

@spec parse_host_list(binary()) :: [binary()]

Parse a comma-separated list of hostnames into a normalised list.

Each entry is trimmed, downcased and has a single trailing dot stripped, so operators get the same normalisation the egress guard applies at match time. Empty or whitespace-only input returns [].

Raises ArgumentError, naming every offending entry, when any entry is empty or looks like something other than a bare hostname: a scheme (://), a path (/), an @, or internal whitespace. Bad entries are never silently dropped.

Colon-bearing forms (host:port, bracketed IPv6 literals) are passed through untouched.