manager, kresctl: allow environment variables to specify paths
This is a bigger feature commit for development convenience with Knot
Resolver Manager. Firstly, it allows the use of KRES_MANAGER_CONFIG
and KRES_MANAGER_RUNTIME
environment variables to specify the paths to
the configuration file and Knot Resolver runtime directory. This lets us
create local workspace scripts with separate configurations e.g. like
this:
script_dir="$(dirname "$(readlink -f "$0")")"
export KRES_MANAGER_RUNTIME="$script_dir"
export KRES_MANAGER_CONFIG="$script_dir/config.yaml"
exec ~/Projects/knot/knot-resolver/manager/poe $@
This ties nicely into the second part, which is that kresctl
is now
able to retrieve the management socket/address directly from the
declarative configuration file of Knot Resolver. This again increases
convenience for developers who may wish to change these often, and not
have to specify/change them every time they want to execute kresctl
from the command line.
kresctl
adds a new --config
option to specify the path to the
configuration file via command line arguments, and also respects the
same KRES_MANAGER_CONFIG
environment variable, when the argument is
not specified.