Next: Variable references, Up: Top [Contents][Index]
Xenv
reads input files and prints on the standard output
their contents, replacing references to the environment variables with
their values and shell commands with the output they produce.
It can be used, in particular, in docker containers where using
environment variables for configuration became a de-facto standard.
This method is obvious when the configuration is consumed by some
programming language (PHP, Python or the like). It is difficult,
however, to expand environment variables in configuration files of the
programs that provide no mechanism for this (such as mysqld
or bind
, for instance). This is where xenv
comes
into play.
By default, xenv
looks in the input text for the variable
references and command invocations in POSIX shell format and expands
them, reproducing the rest of the material verbatim. If the shell
syntax does not suit well the language or structure of the input, an
alternative syntax can be selected from the command line. A number of
additional constructs is provided, such as comments, conditional
directives, etc. These optional features can be controlled from the
command line as well.