summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2016-02-22 11:23:48 +0100
committermakefu <github@syntax-fehler.de>2016-02-22 11:23:48 +0100
commit46c7af2935ccc096ba0e93cd1adf575026edf44a (patch)
treedf322caa923e2fea0e1869691702e71bb2d82a4e
parent725578de4f9b7dfa45e5d3be1b1de93b959ee064 (diff)
cac-api: do not fail silently for missinc cac_secretsgum/master
-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 "$@";;