Compare commits
No commits in common. "cb5933ccf0320d109384fc3bdcb83582600a32b9" and "127146747650a0f9bb59ec9deeaa2079e9983c5d" have entirely different histories.
cb5933ccf0
...
1271467476
@ -14,7 +14,6 @@ type Service struct {
|
|||||||
Address string
|
Address string
|
||||||
appID string
|
appID string
|
||||||
domain string
|
domain string
|
||||||
pathPrefix string
|
|
||||||
port int
|
port int
|
||||||
ttl time.Duration
|
ttl time.Duration
|
||||||
agent *consul.Agent
|
agent *consul.Agent
|
||||||
@ -23,13 +22,12 @@ type Service struct {
|
|||||||
|
|
||||||
var ErrServiceUnavailable = fmt.Errorf("Service is unavailable")
|
var ErrServiceUnavailable = fmt.Errorf("Service is unavailable")
|
||||||
|
|
||||||
func NewService(servAddr, id, name, hostname, domain, pathPrefix string, appPort int) (*Service, error) {
|
func NewService(servAddr, id, name, hostname, domain string, appPort int) (*Service, error) {
|
||||||
s := new(Service)
|
s := new(Service)
|
||||||
s.Name = name
|
s.Name = name
|
||||||
s.Address = hostname
|
s.Address = hostname
|
||||||
s.appID = id
|
s.appID = id
|
||||||
s.domain = domain
|
s.domain = domain
|
||||||
s.pathPrefix = pathPrefix
|
|
||||||
s.port = appPort
|
s.port = appPort
|
||||||
s.ttl = time.Second * 15
|
s.ttl = time.Second * 15
|
||||||
|
|
||||||
@ -142,7 +140,7 @@ func (s *Service) getTags() []string {
|
|||||||
tags := []string{
|
tags := []string{
|
||||||
"traefik.enable=true",
|
"traefik.enable=true",
|
||||||
// "traefik.http.routers." + s.Name + ".rule=Header(`X-API-SERVICE`, `" + s.Name + "`)",
|
// "traefik.http.routers." + s.Name + ".rule=Header(`X-API-SERVICE`, `" + s.Name + "`)",
|
||||||
"traefik.http.routers." + s.Name + ".rule=PathPrefix(`{$s.pathPrefix}`)",
|
"traefik.http.routers." + s.Name + ".rule=PathPrefix(`/catalog`)",
|
||||||
"traefik.http.routers." + s.Name + ".entryPoints=https",
|
"traefik.http.routers." + s.Name + ".entryPoints=https",
|
||||||
"traefik.http.routers." + s.Name + ".tls=true",
|
"traefik.http.routers." + s.Name + ".tls=true",
|
||||||
"traefik.http.routers." + s.Name + ".service=" + s.Name,
|
"traefik.http.routers." + s.Name + ".service=" + s.Name,
|
||||||
@ -151,7 +149,7 @@ func (s *Service) getTags() []string {
|
|||||||
"traefik.http.services." + s.Name + ".loadbalancer.server.port=" + strconv.Itoa(s.port),
|
"traefik.http.services." + s.Name + ".loadbalancer.server.port=" + strconv.Itoa(s.port),
|
||||||
"traefik.http.services." + s.Name + ".loadbalancer.passhostheader=false",
|
"traefik.http.services." + s.Name + ".loadbalancer.passhostheader=false",
|
||||||
"traefik.http.middlewares.requestid.plugin.requestid.headerName=X-Request-ID",
|
"traefik.http.middlewares.requestid.plugin.requestid.headerName=X-Request-ID",
|
||||||
"traefik.http.middlewares.stripPrefix.stripprefix.prefixes=`{$s.pathPrefix}`",
|
"traefik.http.middlewares.stripPrefix.stripprefix.prefixes=/foobar"
|
||||||
"traefik.http.middlewares.compress.compress=true",
|
"traefik.http.middlewares.compress.compress=true",
|
||||||
// "traefik.http.middlewares.cors.headers.accesscontrolallowmethods=*",
|
// "traefik.http.middlewares.cors.headers.accesscontrolallowmethods=*",
|
||||||
// "traefik.http.middlewares.cors.headers.accesscontrolalloworiginlist=*",
|
// "traefik.http.middlewares.cors.headers.accesscontrolalloworiginlist=*",
|
||||||
|
Loading…
Reference in New Issue
Block a user