2016-02-17 12:19:03 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -o pipefail
|
|
|
|
set -o errexit
|
|
|
|
set -o nounset
|
|
|
|
# set -o xtrace
|
|
|
|
|
|
|
|
__dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
2018-01-23 21:02:57 +00:00
|
|
|
__file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
|
|
|
|
__base="$(basename "${__file}" .sh)"
|
|
|
|
|
2016-12-16 07:18:03 +00:00
|
|
|
__root="$(cd "$(dirname "$(dirname "$(dirname "${__dir}")")")" && pwd)"
|
2016-02-17 12:19:03 +00:00
|
|
|
|
2018-01-23 21:02:57 +00:00
|
|
|
__templaterTmpFile=$(mktemp "${TMPDIR:-/tmp}/${__base}.XXXXXX")
|
|
|
|
function cleanup_before_exit () { rm "${__templaterTmpFile:?}"; }
|
|
|
|
trap cleanup_before_exit EXIT
|
|
|
|
|
2016-02-17 12:19:03 +00:00
|
|
|
echo "--"
|
2018-01-23 21:02:57 +00:00
|
|
|
env TARGET_HOST="127.0.0.1" bash "${__root}/src/templater.sh" ./app.template.cfg "${__templaterTmpFile}"
|
|
|
|
cat "${__templaterTmpFile}"
|
2016-02-17 12:19:03 +00:00
|
|
|
|
|
|
|
echo "--"
|
|
|
|
export TARGET_HOST="127.0.0.1"
|
2016-12-16 07:18:03 +00:00
|
|
|
|
|
|
|
# shellcheck source=src/templater.sh
|
|
|
|
source "${__root}/src/templater.sh"
|
|
|
|
|
2018-01-23 21:02:57 +00:00
|
|
|
templater ./app.template.cfg "${__templaterTmpFile}"
|
|
|
|
cat "${__templaterTmpFile}"
|
2016-02-17 12:19:03 +00:00
|
|
|
|
|
|
|
echo "--"
|
2018-01-23 21:02:57 +00:00
|
|
|
env ALLOW_REMAINDERS="1" TARGET_HOST="127.0.0.1" bash "${__root}/src/templater.sh" ./break.template.cfg "${__templaterTmpFile}"
|
|
|
|
cat "${__templaterTmpFile}"
|
2016-02-17 12:19:03 +00:00
|
|
|
|
|
|
|
echo "--"
|
2018-01-23 21:02:57 +00:00
|
|
|
env TARGET_HOST="127.0.0.1" bash "${__root}/src/templater.sh" ./break.template.cfg "${__templaterTmpFile}"
|
|
|
|
cat "${__templaterTmpFile}"
|