lade 0.17.2

Automatically load secrets from your preferred vault as environment variables, and clear them once your shell command is over.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
# show-example <tag> [file]
# Extracts a section from lade.yml (or [file]) based on the tape tag comment.
TAG=$1
FILE=${2:-lade.yml}
awk -v tag="$TAG" '
  BEGIN { found=0; section="" }
  /^# tape: / { 
    if ($3 == tag) { found=1; next } 
    else if (found) { exit }
  }
  found { section = section $0 "\n" }
  END {
    sub(/\n+$/, "", section)
    if (section != "") print section
  }
' "$FILE"