fix(render): set refresh frequency to seconds

This commit is contained in:
Alexis Couvreur
2022-10-28 04:57:37 +00:00
parent 75a478d69e
commit 3196b1aa63
2 changed files with 38 additions and 14 deletions

View File

@@ -37,7 +37,7 @@ type TemplateValues struct {
DisplayName string
InstanceStates []RenderOptionsInstanceState
SessionDuration string
RefreshFrequency time.Duration
RefreshFrequency string
Version string
}
@@ -61,7 +61,7 @@ func Render(options RenderOptions, writer io.Writer) error {
DisplayName: options.DisplayName,
InstanceStates: options.InstanceStates,
SessionDuration: humanizeDuration(options.SessionDuration),
RefreshFrequency: options.RefreshFrequency,
RefreshFrequency: fmt.Sprintf("%d", int64(options.RefreshFrequency)),
Version: options.Version,
})
}

View File

@@ -1,16 +1,40 @@
version: "3.9"
services:
sablier:
image: gchr.io/acouvreur/sablier:latest
command:
- --swarmMode=true
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
networks:
- traefik
networks:
traefik:
external: true
name: traefik
image: traefik:2.9.1
command:
- --entryPoints.http.address=:80
- --providers.docker=true
- --providers.file.filename=/etc/traefik/dynamic-config.yml
- --experimental.plugins.sablier.moduleName=github.com/acouvreur/sablier
- --experimental.plugins.sablier.version=v1.0.0-beta.2
ports:
- "8080:80"
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
- './dynamic-config.yml:/etc/traefik/dynamic-config.yml'
sablier:
image: ghcr.io/acouvreur/sablier:local
command:
- start
- --provider.name=docker
volumes:
- '/var/run/docker.sock:/var/run/docker.sock'
labels:
- traefik.enable=true
# Dynamic Middleware
- traefik.http.middlewares.dynamic.plugin.sablier.name=sablier_whoami_1
- traefik.http.middlewares.dynamic.plugin.sablier.serviceUrl=http://sablier:10000
- traefik.http.middlewares.dynamic.plugin.sablier.timeout=1m
- traefik.http.middlewares.dynamic.plugin.sablier.displayname=Dynamic Whoami
whoami:
image: containous/whoami:v1.5.0
# Cannot use labels because as soon as the container is stopped, the labels are not treated by Traefik
# The route doesn't exist anymore. Use dynamic-config.yml file instead.
# labels:
# - traefik.enable
# - traefik.http.routers.whoami-dynamic.rule=PathPrefix(`/dynamic/whoami`)
# - traefik.http.routers.whoami-dynamic.middlewares=dynamic@docker