这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion plugins/traefik-vhosts/templates/compose.yml.sigil
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,21 @@ services:
- --certificatesresolvers.leresolver.acme.tlschallenge=true
{{ end }}

{{ if or (eq $.TRAEFIK_API_ENABLED "true") ($.TRAEFIK_BASIC_AUTH) ($.TRAEFIK_LETSENCRYPT_EMAIL) }}
labels:
{{ else }}
labels: []
{{ end }}

{{ if eq $.TRAEFIK_API_ENABLED "true" }}
# Dashboard
- "traefik.http.routers.api.rule=Host(`{{ $.TRAEFIK_API_VHOST }}`)"
- "traefik.http.routers.api.service=api@internal"
- "traefik.http.routers.api.entrypoints={{ if $.TRAEFIK_LETSENCRYPT_EMAIL }}https{{ else }}http{{ end }}"
{{ end }}

- "traefik.http.routers.api.middlewares=auth"
{{ if $.TRAEFIK_BASIC_AUTH }}
- "traefik.http.routers.api.middlewares=auth"
- "traefik.http.middlewares.auth.basicauth.users={{ $.TRAEFIK_BASIC_AUTH }}"
{{ end }}

Expand Down
22 changes: 22 additions & 0 deletions tests/unit/traefik.bats
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,25 @@ teardown() {
echo "status: $status"
assert_output "http:80:5000"
}

@test "(traefik) show-config without auth set" {
run /bin/bash -c "dokku traefik:set --global basic-auth-username \"\""
run /bin/bash -c "dokku traefik:set --global basic-auth-password \"\""

run /bin/bash -c "dokku traefik:show-config"
echo "output: $output"
echo "status: $status"
assert_success
refute_line ' - "traefik.http.routers.api.middlewares=auth"'
}

@test "(traefik) show-config with auth set" {
run /bin/bash -c "dokku traefik:set --global basic-auth-username test-username"
run /bin/bash -c "dokku traefik:set --global basic-auth-password test-password"

run /bin/bash -c "dokku traefik:show-config"
echo "output: $output"
echo "status: $status"
assert_success
assert_line ' - "traefik.http.routers.api.middlewares=auth"'
}