Skip to content

Commit

Permalink
listen address cli flag
Browse files Browse the repository at this point in the history
  • Loading branch information
aditsachde committed Jul 8, 2024
1 parent 785d5f0 commit aa50ae0
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion cmd/itko-monitor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
func main() {
// Parse the command-line flags
storeAddress := flag.String("store-address", "", "Tile storage url. Must end with a trailing slash.")
listenAddress := flag.String("listen-address", "", "IP and port to listen on for incoming connections.")
maskSize := flag.Int("mask-size", 0, "Mask size for the quadtree.")
flag.Parse()

Expand All @@ -22,13 +23,19 @@ func main() {
os.Exit(1) // Exit with a non-zero status
}

if *listenAddress == "" {
fmt.Println("Error: -listen-address flag must be set")
flag.Usage() // Print the usage message
os.Exit(1) // Exit with a non-zero status
}

if *maskSize == 0 {
fmt.Println("Error: -mask-size flag must be set")
flag.Usage() // Print the usage message
os.Exit(1) // Exit with a non-zero status
}

listener, err := net.Listen("tcp", "localhost:8080")
listener, err := net.Listen("tcp", *listenAddress)
if err != nil {
log.Fatalf("failed to bind to address: %v", err)
}
Expand Down

0 comments on commit aa50ae0

Please sign in to comment.