Module plugx_config::loader

source ·
Expand description

Configuration loader trait and implementations.

A configuration loader only loads contents of one or more plugins. No parsing is done here. The result is just a hashmap with plugin names (in lowercase) as keys and ConfigurationEntity as values. A loader also should try to set contents format for each plugin. For example fs (that implements ConfigurationLoader) that loads configurations from filesystem, guesses content formats from file extensions.

Main method of ConfigurationLoader trait is try_load that accepts a URL and maybe a whitelist of plugin names. It can parse the URL to detect and validate its own options. For example env that loads configuration from environment-variables accepts a URL like env://?prefix=MY_APP_NAME and fs accepts a URL like file:///path/to/a/file.json?skippable[0]=notfound (skippable is a list and should contain error kinds that we want to skip if they happen).

Note that generally you do not need to implement ConfigurationLoader for your own structs and provided closure lets you implement your own loader with just one Fn closure.

Modules

  • Custom configuration loader with Fn.
  • Environment-Variables configuration loader.
  • File system configuration loader.

Enums

Traits

Functions

Type Aliases