summaryrefslogtreecommitdiffstats
path: root/cac-api
diff options
context:
space:
mode:
Diffstat (limited to 'cac-api')
-rwxr-xr-xcac-api16
1 files changed, 14 insertions, 2 deletions
diff --git a/cac-api b/cac-api
index 174353c..76a0723 100755
--- a/cac-api
+++ b/cac-api
@@ -17,8 +17,6 @@ cac_templates_cache=${cac_templates_cache-$HOME/tmp/cac_templates_cache.json}
cac_secrets=${cac_secrets-$HOME/.secrets/cac-api}
-. "$cac_secrets" >/dev/null 2>&1 || :
-
cac_api() {
__cac_api_cli__command=${1-help}
@@ -485,6 +483,20 @@ printf %s $binaryPrefix | tr -d 0 | wc -c
)}
#
+#?
+#? cac-api will try to load secrets from $cac_secrets
+#? and return with error code 1.
+__cac_load_secrets() {
+ if test -r "$cac_secrets"; then
+ echo "unable to load secrets from '$cac_secrets'" >&2
+ __cac_api_cli__help
+ return 1
+ else
+ . "$cac_secrets"
+ fi
+}
+
+__cac_load_secrets
case ${run-true} in
true) cac_api "$@";;