For generating configs for my Docker services using gomplate
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
528 B

#! /bin/bash
INPUT_DIR=${INPUT_DIR:-/templates}
OUTPUT_DIR=${OUTPUT_DIR:-/config}
shopt -s globstar
echo "Running at $(date)..."
for f in "$INPUT_DIR"/**/* ; do
of="$OUTPUT_DIR${f#$INPUT_DIR}"
if [ ! -f "$f" ]; then
echo " > Skipping: $f not a file"
continue
fi
if [ "$f" -nt "$of" ]; then
echo " > Generating new $of"
mkdir -p "$(dirname $of)"
gomplate $FLAGS -f "$f" -o "$of"
else
echo " > Skipping: $f because $of is newer"
fi
done
echo "Complete"