Skip to content

Commit

Permalink
normalize config var descriptions; dry bootstrap.bash
Browse files Browse the repository at this point in the history
  • Loading branch information
qrkourier committed Mar 19, 2024
1 parent 8a49542 commit c2b37a9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions dist/dist-packages/linux/openziti-controller/bootstrap.bash
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,12 @@ function makeConfig() {
# create config file
#

shopt -s nocasematch # toggle off case-insensitive comparison to simplify regexp
if [[ -n "${1:-}" && "$1" =~ .*\.ya?ml$ ]]; then
# enforce first argument is a non-empty string that does not begin with "--" (long option prefix)
if [[ -n "${1:-}" && ! "${1}" =~ ^-- ]]; then
local ZITI_CTRL_CONFIG_FILE="${1}"
shift
else
echo "ERROR: no config file path provided ending like *.yml" >&2
shopt -u nocasematch # toggle on case-sensitive comparison
echo "ERROR: no config file path provided" >&2
return 1
fi
shopt -u nocasematch # toggle on case-sensitive comparison
Expand Down Expand Up @@ -174,10 +173,11 @@ function makeDatabase() {
mkdir -p "$DB_DIR"
fi

if [[ -n "${ZITI_PWD:-}" || -s /run/credentials/${UNIT_NAME:=ziti-controller.service}/ZITI_PWD ]]; then
: "${ZITI_PWD:=$(< "/run/credentials/${UNIT_NAME:-ziti-controller.service}/ZITI_PWD")}"
if [ -n "${ZITI_PWD}" ]; then
ziti controller edge init "${ZITI_CTRL_CONFIG_FILE}" \
--username "${ZITI_USER}" \
--password "${ZITI_PWD:-$(< "/run/credentials/${UNIT_NAME}/ZITI_PWD")}"
--password "${ZITI_PWD}"
else
echo "ERROR: need admin password; use LoadCredential or SetCredential in"\
" /lib/systemd/system/ziti-controller.service or set env var ZITI_PWD with at least 5 characters" >&2
Expand Down
14 changes: 7 additions & 7 deletions ziti/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ const (
ZitiHomeVarDescription = "Root home directory for Ziti-related files"

PkiCtrlCertVarName = "ZITI_PKI_CTRL_CERT"
PkiCtrlCertVarDescription = "Path to controller's default identity client cert"
PkiCtrlCertVarDescription = "Path to the controller's default identity client cert"
PkiCtrlServerCertVarName = "ZITI_PKI_CTRL_SERVER_CERT"
PkiCtrlServerCertVarDescription = "Path to controller's default identity server cert, including partial chain"
PkiCtrlServerCertVarDescription = "Path to the controller's default identity server cert, including partial chain"
PkiCtrlKeyVarName = "ZITI_PKI_CTRL_KEY"
PkiCtrlKeyVarDescription = "Path to controller's default identity private key"
PkiCtrlKeyVarDescription = "Path to the controller's default identity private key"
PkiCtrlCAVarName = "ZITI_PKI_CTRL_CA"
PkiCtrlCAVarDescription = "Path to the controller's bundle of trusted root CAs"
CtrlBindAddressVarName = "ZITI_CTRL_BIND_ADDRESS"
Expand Down Expand Up @@ -103,13 +103,13 @@ const (
CtrlPkiEdgeCAVarName = "ZITI_PKI_EDGE_CA"
CtrlPkiEdgeCAVarDescription = "Path to the controller's web identity root CA cert"
PkiAltServerCertVarName = "ZITI_PKI_ALT_SERVER_CERT"
PkiAltServerCertVarDescription = "Path to controller's root identity alternative server certificate. Requires ZITI_PKI_ALT_SERVER_KEY"
PkiAltServerCertVarDescription = "Path to the controller's root identity alternative server certificate. Requires ZITI_PKI_ALT_SERVER_KEY"
PkiAltServerKeyVarName = "ZITI_PKI_ALT_SERVER_KEY"
PkiAltServerKeyVarDescription = "Path to controller's root identity alternative private key. Requires ZITI_PKI_ALT_SERVER_CERT"
PkiAltServerKeyVarDescription = "Path to the controller's root identity alternative private key. Requires ZITI_PKI_ALT_SERVER_CERT"
ZitiEdgeRouterNameVarName = "ZITI_ROUTER_NAME"
ZitiEdgeRouterNameVarDescription = "A slug by which to name the router's identity-related files"
ZitiEdgeRouterNameVarDescription = "A filename prefix for the router's key and certs"
ZitiEdgeRouterPortVarName = "ZITI_ROUTER_PORT"
ZitiEdgeRouterPortVarDescription = "Router's exposed TCP port"
ZitiEdgeRouterPortVarDescription = "TCP port on which the router will listen for edge connections"
ZitiRouterIdentityCertVarName = "ZITI_ROUTER_IDENTITY_CERT"
ZitiRouterIdentityCertVarDescription = "Path in which to write the router's client certificate during enrollment"
ZitiRouterIdentityServerCertVarName = "ZITI_ROUTER_IDENTITY_SERVER_CERT"
Expand Down

0 comments on commit c2b37a9

Please sign in to comment.