feat(go-swagger): Small refacto on launcher
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Matthieu 'JP' DERASSE
2022-09-21 21:18:12 +00:00
parent cda86019bb
commit b7f0d796e4
6 changed files with 113 additions and 33 deletions

View File

@ -2,7 +2,7 @@
# the launcher file will launch the correct app / worker based on the given env variable
# the main goal of that launcher is to be used as a Docker entrypoint
# APP_TYPE: Can be api or worker
# APP_TYPE: Can be api, worker or cron
case "$APP_TYPE" in
{{ if eq (len .APIs) 1 }}
@ -33,9 +33,29 @@ case "$APP_TYPE" in
esac
;;
{{end}}
{{- if ne (len .Crons) 0 }}
# Crons
cron)
case "$CRON_NAME" in
{{range .Crons}}
# Cron {{.Name}}
{{.Name}}) exec /app/{{.Binary}} ;;
{{end}}
# otherwise
*)
echo "** invalid CRON_NAME='$CRON_NAME'. Please use a valid cron name!"
exit 1
;;
esac
;;
{{end}}
# otherwise
*)
echo "** invalid APP_TYPE='$APP_TYPE' ! Please use API or WORKER!"
echo "** invalid APP_TYPE='$APP_TYPE' ! Please use API, WORKER or CRON!"
exit 1
;;
esac