aboutsummaryrefslogtreecommitdiff
path: root/lib/subcommands/var.bash
diff options
context:
space:
mode:
Diffstat (limited to 'lib/subcommands/var.bash')
-rw-r--r--lib/subcommands/var.bash12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/subcommands/var.bash b/lib/subcommands/var.bash
index 3e8fc0b..4eaf14d 100644
--- a/lib/subcommands/var.bash
+++ b/lib/subcommands/var.bash
@@ -8,12 +8,14 @@ subcommand()
{
local key
local value
+ local secret
# Handle opts
- while getopts ":p:" opt
+ while getopts ":p:s" opt
do
case "$opt" in
p) export BASHTARD_PLAYBOOK="$OPTARG" ;;
+ s) secret=1 ;;
*) emerg "Unused opt '$opt'?" ;;
esac
done
@@ -40,7 +42,13 @@ subcommand()
local kvfile
local buffer
- kvfile="$BASHTARD_ETCDIR/hosts.d/${BASHTARD_PLATFORM[fqdn]}"
+ if [[ $secret ]]
+ then
+ kvfile="$BASHTARD_ETCDIR/secrets"
+ else
+ kvfile="$BASHTARD_ETCDIR/hosts.d/${BASHTARD_PLATFORM[fqdn]}"
+ fi
+
buffer="$(tmpfile)"
grep -v "^$key=" < "$kvfile" > "$buffer"