Configuration placeholders resolution.
A placeholder is ${alternative|alternative|...} in a configuration value. An alternative is either resolver=argument (env=HOME , conf=section.key , registered resolvers) or a default value. The first alternative which resolves is used:
url=http://${env=HOST|localhost}:${conf=server.port}/
Resolution is event driven: values without pending dependency are resolved first; each resolved value is written in its section and fires a "resolved" event in a synchronous queue. Values which reference it with conf= are then completed and fire their own event, until the queue is empty.
Resolved values are literal: a value which contains ${...} after resolution (for example an environment variable) is not interpreted again. With the watchdog, resolution always terminates:
- a resolution chain longer than the maximum depth is an error (
CYCLE )
- values still waiting when the queue is empty reference each other: the cycle is an error (
CYCLE )
Other errors: unknown resolver (RES_NOT_FOUND ), placeholder without resolvable alternative (NOT_RES ), invalid syntax such as nested placeholders (PARSING_ERROR ).
- Author
- Vincent Lachenal
- Since
- 0.2