Last active
June 25, 2018 14:39
-
-
Save udondan/58195fe5801287e6e5ed1a9505b0baa2 to your computer and use it in GitHub Desktop.
This file contains 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 | |
CONTENT="$1" | |
# Create a random file name for tmp files | |
RAND=$(cat /dev/urandom | env LC_CTYPE=C tr -dc 'a-zA-Z0-9' | head -c 32) | |
TMPFILE="/tmp/$RAND" | |
# Render content to tmp file and output content | |
echo -e "$CONTENT" > "$TMPFILE.in" | |
consul-template -template "$TMPFILE.in:$TMPFILE.out" -once | |
cat "$TMPFILE.out" | |
# Clean up | |
rm "$TMPFILE.in" "$TMPFILE.out" |
This file contains 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
template { | |
contents = "{{ key \"some/key\" | plugin \"consul-render\" }}" | |
destination = "/some/file" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment