Created
October 20, 2023 14:58
-
-
Save micahlmartin/30459e3efb9d8dbf5ef2fafefbcf5bcf to your computer and use it in GitHub Desktop.
Bash helpers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eo pipefail | |
getSecret() { | |
path="$1" | |
vault kv get --format=json $path | jq '.data.data' | |
} | |
log_debug() { | |
local message="$1" | |
if [ ! -z "$DEBUG" ]; then | |
echo "---------> DEBUG: $message" | |
fi | |
} | |
# Function to log a message | |
log() { | |
local message="---------> INFO: $1" | |
echo "$message" | |
} | |
# Function to log an error message and exit | |
fatal() { | |
local message="$1" | |
>&2 echo "----> Error: $message" | |
exit 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment