I have a question about the “home” parameter of confd.
Here is the command run in my computer: /opt/confd/lib/confd/erts/bin/confd.smp -S 4 -K false -MHe true -- -root /opt/confd/lib/confd -progname confd -- -home /nonexistent -- -smp enable -boot confd -noshell -noinput -foreground -yaws embedded true -stacktrace_depth 24 -verbose -shutdown_time 30000 -conffile /opt/confd-k8s/confd.conf -start_phase0 -max_fds 1048576
The process works fine. But the home argument /nonexistent is actually a non-existent directory. My question is what is this parameter “-home” for? Is there any impact if the diectory does not exist?
By the way, this home parameter is not described in confd user guide 7.3. Why?
The confd command documented in the confd(1) manual page is $CONFD_DIR/bin/confd, i.e. the confd that is in your $PATH after sourcing confdrc. It is actually a script, which via another executable eventually invokes either $CONFD_DIR/lib/confd/erts/bin/confd or $CONFD_DIR/lib/confd/erts/bin/confd.smp, which is actually the Erlang VM that runs the ConfD code. The set of arguments passed to the latter is a ConfD-internal interface, that you really shouldn’t care about - some of them are derived from the arguments passed to $CONFD_DIR/bin/confd, others are not.
(To answer your question though, the Erlang VM expects that the $HOME environment variable is set, which it will normally be if you invoke confd in an interactive shell, but typically not when invoked from e.g. an rc script run at boot. Thus the confd script sets $HOME to / if it isn’t set in the environment. I.e. apparently $HOME is set to /nonexistent in the environment where you invoke confd - which is not an unreasonable alternative to having it unset for the rc script case.
Anyway, while the Erlang VM requires $HOME to be set, the ConfD code running in the VM makes no use of this, so it doesn’t really matter what $HOME is set to.)