Skip to content

Commit

Permalink
In registry, make consul datacenter a flag (#29)
Browse files Browse the repository at this point in the history
* In registry, make consul datacenter a flag
* Change datacenter flag default to Consul's default
  • Loading branch information
josephgorse authored and king-jam committed Sep 23, 2016
1 parent 0ad0bf5 commit 4b31f10
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions registry/cmd/registry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ import (
)

var binaryName, buildDate, buildUser, commitHash, goVersion, osArch, releaseVersion string
var backendAddr string
var backendAddr, datacenter string

func init() {
flag.StringVar(&backendAddr, "address", "127.0.0.1:8500", "Address:port of the backend store")
flag.StringVar(&datacenter, "datacenter", "dc1", "Datacenter name of the backend storage")
}

func main() {
Expand All @@ -31,7 +32,7 @@ func main() {
flag.Parse()

consul.Register()
registry, err := registry.NewRegistry(libreg.CONSUL, "dc-docker", backendAddr)
registry, err := registry.NewRegistry(libreg.CONSUL, datacenter, backendAddr)
if err != nil {
log.Fatalf("Error creating new Service Registry: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion registry/docker-compose-registry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ services:
- "8500/udp"
- "8600"
- "8600/udp"
command: "-address=consulclient:8500"
command: "-address=consulclient:8500 -datacenter=dc-docker"
depends_on:
- consulclient
ssdpspoofer:
Expand Down

0 comments on commit 4b31f10

Please sign in to comment.