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.
2021-01-28 21:48:30 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
|
|
|
### Usage: /docker-entrypoint.sh <command> <args>
|
2021-02-04 15:43:00 +00:00
|
|
|
function main() {
|
|
|
|
executable=$1
|
|
|
|
command=$2
|
2021-01-30 10:54:17 +00:00
|
|
|
|
2021-02-04 15:43:00 +00:00
|
|
|
if [[ "$executable" != "dex" ]] && [[ "$executable" != "$(which dex)" ]]; then
|
|
|
|
exec $@
|
|
|
|
fi
|
2021-01-28 21:48:30 +00:00
|
|
|
|
2021-02-04 15:43:00 +00:00
|
|
|
if [[ "$command" != "serve" ]]; then
|
2021-01-28 21:48:30 +00:00
|
|
|
exec $@
|
2021-02-04 15:43:00 +00:00
|
|
|
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 $@
|