diff --git a/bin/ca-init b/bin/ca-init index c45f95f..527ee47 100755 --- a/bin/ca-init +++ b/bin/ca-init @@ -43,7 +43,7 @@ while :; do case "$1" in -h|--help) usage; exit 0;; -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;; -l|--crl-days) shift; USER_CA_CRL_DAYS="$1"; shift;; -b|--bits) shift; USER_CA_CRT_BITS="$1"; shift;; diff --git a/lib/ca-functions b/lib/ca-functions index 866973a..aa84976 100644 --- a/lib/ca-functions +++ b/lib/ca-functions @@ -55,11 +55,18 @@ ca_load_conf() { source "$CONFFILE" fi # 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 source "$CONFFILE" 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 # TODO: Refactored config loader with error fallback, allowing local overrides.