2022-11-18 15:08:16 +00:00
|
|
|
#!/bin/sh
|
2023-02-12 20:59:55 +00:00
|
|
|
|
2022-11-18 15:08:16 +00:00
|
|
|
set -e
|
|
|
|
|
|
|
|
# Create the dynamic config directory in the shared volume.
|
2023-02-12 20:59:55 +00:00
|
|
|
mkdir -p {{ .Traefik.SharedMountPoint }}/dynamic
|
|
|
|
chgrp {{ .FlowGID }} {{ .Traefik.SharedMountPoint }}/dynamic
|
|
|
|
chmod a-rwx,u+rwx,g+rwx {{ .Traefik.SharedMountPoint }}/dynamic
|
2022-11-18 15:08:16 +00:00
|
|
|
|
2023-08-01 01:15:48 +01:00
|
|
|
# Move any dynamic config to the new directory.
|
2023-08-01 02:45:28 +01:00
|
|
|
for f in $( find /tmp -mindepth 1 -maxdepth 1 -type f -iname 'dynamic*.yaml' -exec basename {} \; ); do
|
|
|
|
echo "INFO: Moving /tmp/${f} to {{ .Traefik.SharedMountPoint }}/dynamic/${f}..."
|
2023-08-01 01:15:48 +01:00
|
|
|
mv -f /tmp/${f} {{ .Traefik.SharedMountPoint }}/dynamic/${f}
|
|
|
|
done
|
2022-11-18 15:08:16 +00:00
|
|
|
|
|
|
|
# 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 "$@"
|