Skip to main content

Module config

Module config 

Source
Expand description

A configuration file, so that six hosts are not six command lines.

Unknown keys are refused rather than ignored. A configuration file is exactly where a typo is invisible: suffixx = "dev" that is quietly dropped leaves the daemon running on a suffix nobody chose, and looking no different from one that was configured. Refusing costs one confusing start and saves an hour of confusion later.

Aliases from a file are built through Alias::new, the same constructor the command line uses. Two entry points and one set of rules is fine; two entry points and two copies of the rules is how the looser copy becomes the one that matters.

Structs§

Config
Overrides
What the command line said, all of it optional because anything it leaves out the file may supply and anything neither supplies has a default.
Resolved
What the daemon will actually run with.
Server
The [server] table. Every key is optional: a file listing only aliases is a perfectly good file, and the defaults belong to the command line that owns them.

Constants§

DEFAULT_PORT
DEFAULT_SUFFIX

Functions§

default_path
Where a configuration file is looked for when none was named.
ensure_distinct
Refuse two aliases with the same name.
load
Read a configuration file.
merge
Fold the command line over the file.
parse
Parse the text of a configuration file.