Added specifying config on cli that user home config does not override.
This commit is contained in:
parent
ca7975f2c1
commit
15cba346cf
2 changed files with 10 additions and 3 deletions
|
@ -43,7 +43,7 @@ while :; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
-h|--help) usage; exit 0;;
|
-h|--help) usage; exit 0;;
|
||||||
-c|--encrypt) CRYPTKEY=""; shift;;
|
-c|--encrypt) CRYPTKEY=""; shift;;
|
||||||
-f|--config) shift; CONFFILE="$1"; shift;;
|
-f|--config) shift; CONFFILE="$1"; CONFFILECLI=1; shift;;
|
||||||
-d|--days) shift; USER_CA_DAYS="$1"; shift;;
|
-d|--days) shift; USER_CA_DAYS="$1"; shift;;
|
||||||
-l|--crl-days) shift; USER_CA_CRL_DAYS="$1"; shift;;
|
-l|--crl-days) shift; USER_CA_CRL_DAYS="$1"; shift;;
|
||||||
-b|--bits) shift; USER_CA_CRT_BITS="$1"; shift;;
|
-b|--bits) shift; USER_CA_CRT_BITS="$1"; shift;;
|
||||||
|
|
|
@ -55,11 +55,18 @@ ca_load_conf() {
|
||||||
source "$CONFFILE"
|
source "$CONFFILE"
|
||||||
fi
|
fi
|
||||||
# Override system configuration with local values.
|
# Override system configuration with local values.
|
||||||
source "$HOME/.ca-scripts.conf"
|
# If manually set on command-line, don't load.
|
||||||
|
if [ -n "$CONFFILECLI" ]; then
|
||||||
|
source "$HOME/.ca-scripts.conf"
|
||||||
|
fi
|
||||||
elif [ -r "$CONFFILE" ]; then
|
elif [ -r "$CONFFILE" ]; then
|
||||||
source "$CONFFILE"
|
source "$CONFFILE"
|
||||||
else
|
else
|
||||||
error "Unable to load $HOME/.ca-scripts.conf or $CONFFILE"
|
if [ -n "$CONFFILECLI" ]; then
|
||||||
|
error "Unable to load $HOME/.ca-scripts.conf or $CONFFILE"
|
||||||
|
else
|
||||||
|
error "Unable to load $CONFFILE"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: Refactored config loader with error fallback, allowing local overrides.
|
# TODO: Refactored config loader with error fallback, allowing local overrides.
|
||||||
|
|
Loading…
Reference in a new issue