Skip to content

Instantly share code, notes, and snippets.

@micahlmartin
Created October 20, 2023 14:58
Show Gist options
  • Save micahlmartin/30459e3efb9d8dbf5ef2fafefbcf5bcf to your computer and use it in GitHub Desktop.
Save micahlmartin/30459e3efb9d8dbf5ef2fafefbcf5bcf to your computer and use it in GitHub Desktop.
Bash helpers
#!/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