You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a user I would like to define two backends on deployment
So that I can route dynamically with acls in haproxy
Scenario:
Given I have the following template:
frontend www
bind *:80
reqadd x-forwarded-proto:\ http
default_backend consul
{{ range services }}
{{ if .Tags.Contains "http" }}
acl host_{{ .Name }} hdr(host) -i {{ .Name }}.{{ or (env "HAPROXY_DOMAIN") "fmr.com" }}
acl host_{{ .Name }}_uri path_beg -i /{{ .Name }}
use_backend {{ .Name }}_backend if host_{{ .Name }}
use_backend {{ .Name }}_backend if host_{{ .Name }}_uri
{{ else if and (.Tags.Contains "http") (.Tags.Contains "deploy") }}
acl host_{{ .service.Attrs.DirectName }} hdr(host) -i {{ .service.Attrs.DirectName }}.{{ or (env "HAPROXY_DOMAIN") "fmr.com" }}
acl host_{{ .service.Attrs.DirectName }}_uri path_beg -i /{{ .service.Attrs.DirectName }}
use_backend {{ .service.Attrs.DirectName }}_backend if host_{{ .Name }}
use_backend {{ .service.Attrs.DirectName }}_backend if host_{{ .Name }}_uri
{{ end }}
{{ end }}
{{ range services }}
{{ if (.Tags.Contains "http") }}
backend {{ .Name }}_backend
reqirep ^([^\ :]*\ /){{.Name}}[/]?(.*) \1\2
{{ range service .Name}}
server {{ .Node }} {{ .Address }}:{{ .Port }}
{{ end }}
backend {{ .node.attrs.directname }}_backend
reqirep ^([^\ :]*\ /){{.service.Attrs.DirectName}}[/]?(.*) \1\2
{{ range service .Name}}
server {{ .Node }} {{ .Address }}:{{ .Port }}
{{ end }}
{{ end }}
{{ end }}
And provide the environment variable SERVICE_DIRECTNAME
Then consul-template should expand the values from SERVICE_DIRECTNAME into service.Attrs.DirectName on template generation
The text was updated successfully, but these errors were encountered:
I'm not familiar with registrator, and Consul Template is designed to integrate with Consul and Vault. I don't think this is something we plan to implement ourselves, but we would gladly review a pull request to implement this functionality. Thanks! 😄
As a user I would like to define two backends on deployment
So that I can route dynamically with acls in haproxy
Scenario:
Given I have the following template:
And provide the environment variable SERVICE_DIRECTNAME
Then consul-template should expand the values from SERVICE_DIRECTNAME into service.Attrs.DirectName on template generation
The text was updated successfully, but these errors were encountered: