github.com/drud/ddev@v1.21.5-alpha1.0.20230226034409-94fcc4b94453/pkg/ddevapp/traefik_config_template.yaml (about) 1 #ddev-generated 2 3 http: 4 routers: 5 {{$appname := .App.Name}}{{ range $s := .RoutingTable }} 6 {{ if not $s.HTTPS }} 7 {{$appname}}-{{$s.InternalServiceName}}-{{$s.InternalServicePort}}-http: 8 {{if not $.UseLetsEncrypt}}{{/* Let's Encrypt only works with Host(), but we need HostRegex() for wildcards*/}} 9 rule: HostRegexp({{ range $i, $h := $s.ExternalHostnames }}{{if $i}}, {{end}}`{{$h}}`{{end}}) 10 {{else}} 11 rule: Host({{ range $i, $h := $s.ExternalHostnames }}{{if $i}}, {{end}}`{{$h}}`{{end}}) 12 {{end}} 13 service: "{{$appname}}-{{$s.InternalServiceName}}-{{$s.InternalServicePort}}-http" 14 tls: false 15 entrypoints: 16 - http-{{$s.ExternalPort}} 17 {{ end }}{{ end }} 18 {{$appname := .App.Name}}{{ range $s := .RoutingTable }}{{ if $s.HTTPS }} 19 {{$appname}}-{{$s.InternalServiceName}}-{{$s.InternalServicePort}}-https: 20 {{if not $.UseLetsEncrypt}}{{/* Let's Encrypt only works with Host(), but we need HostRegex() for wildcards*/}} 21 rule: HostRegexp({{ range $i, $h := $s.ExternalHostnames }}{{if $i}}, {{end}}`{{$h}}`{{end}}) 22 {{else}} 23 rule: Host({{ range $i, $h := $s.ExternalHostnames }}{{if $i}}, {{end}}`{{$h}}`{{end}}) 24 {{end}} 25 service: "{{$appname}}-{{$s.InternalServiceName}}-{{$s.InternalServicePort}}-https" 26 {{ if not $.UseLetsEncrypt }} 27 tls: true 28 {{ else }} 29 tls: 30 certResolver: acmeresolver 31 {{end}} 32 entrypoints: 33 - http-{{$s.ExternalPort}} 34 {{ end }} 35 {{ end }} 36 37 services: 38 {{$appname := .App.Name}}{{ range $s := .RoutingTable }}{{ if $s.HTTPS }} 39 {{$appname}}-{{ $s.InternalServiceName }}-{{ $s.InternalServicePort }}-https: 40 {{ else }} 41 {{$appname}}-{{ $s.InternalServiceName }}-{{ $s.InternalServicePort }}-http:{{end}} 42 loadbalancer: 43 servers: 44 - url: http://ddev-{{$appname}}-{{$s.InternalServiceName}}:{{$s.InternalServicePort}} 45 {{ end }} 46 47 {{ if not .UseLetsEncrypt }}{{/* let's encrypt doesn't work if there's already a provided cert */}} 48 tls: 49 certificates: 50 - certFile: {{ .TargetCertsPath }}/{{ .App.Name }}.crt 51 keyFile: {{ .TargetCertsPath }}/{{ .App.Name }}.key 52 {{end}}