31 lines
896 B
Bash
31 lines
896 B
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
DASHBOARD_CONFIG_SRC="/tmp/dynamic_dashboard.yaml"
|
|
DASHBOARD_CONFIG_DEST="/helix/shared/traefik/dynamic/dashboard.yaml"
|
|
|
|
# Create the dynamic config directory in the shared volume.
|
|
mkdir -p /helix/shared/traefik/dynamic
|
|
chgrp {{ .GroupId }} /helix/shared/traefik/dynamic
|
|
chmod a-rwx,u+rwx,g+rwx /helix/shared/traefik/dynamic
|
|
|
|
# Move the dashboard config to the new directory.
|
|
if [ -f ${DASHBOARD_CONFIG_SRC} ]; then
|
|
mv ${DASHBOARD_CONFIG_SRC} ${DASHBOARD_CONFIG_DEST}
|
|
fi
|
|
|
|
# first arg is `-f` or `--some-option`
|
|
if [ "${1#-}" != "$1" ]; then
|
|
set -- traefik "$@"
|
|
fi
|
|
|
|
# if our command is a valid Traefik subcommand, let's invoke it through Traefik instead
|
|
# (this allows for "docker run traefik version", etc)
|
|
if traefik "$1" --help >/dev/null 2>&1
|
|
then
|
|
set -- traefik "$@"
|
|
else
|
|
echo "= '$1' is not a Traefik command: assuming shell execution." 1>&2
|
|
fi
|
|
|
|
exec "$@"
|