This repository has been archived on 2023-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
dex/docker-entrypoint.sh
Maksim Nabokikh dd4a62e645 Apply suggestions from code review
Co-authored-by: Márk Sági-Kazár <sagikazarmark@users.noreply.github.com>
Signed-off-by: m.nabokikh <maksim.nabokikh@flant.com>
2021-02-04 21:17:30 +04:00

33 lines
609 B
Bash
Executable File

#!/bin/sh -e
### Usage: /docker-entrypoint.sh <command> <args>
function main() {
executable=$1
command=$2
if [[ "$executable" != "dex" ]] && [[ "$executable" != "$(which dex)" ]]; then
exec $@
fi
if [[ "$command" != "serve" ]]; then
exec $@
fi
for tpl_candidate in $@ ; do
case "$tpl_candidate" in
*.tpl|*.tmpl|*.yaml)
tmp_file=$(mktemp /tmp/dex.config.yaml-XXXXXX)
gomplate -f "$tpl_candidate" -o "$tmp_file"
args="${args} ${tmp_file}"
;;
*)
args="${args} ${tpl_candidate}"
;;
esac
done
exec $args
}
main $@