Skip to content

Commit

Permalink
Use checkConfig function in main
Browse files Browse the repository at this point in the history
  • Loading branch information
dechristopher committed Sep 10, 2020
1 parent 5b4c40b commit b2172d6
Showing 1 changed file with 2 additions and 21 deletions.
23 changes: 2 additions & 21 deletions main.go
Expand Up @@ -74,27 +74,8 @@ func main() {
printHelp()
}

// ensure a URL is provided
if *url == "" {
fmt.Printf("No cache URL specified!\n" +
"Use `--url` to specify the cache URL.\n" +
"Use `--help` to learn more.\n")
os.Exit(1)
}

// ensure proper URL
_, err := liburl.Parse(*url)
if err != nil {
fmt.Printf("Invalid cache URL provided. Must be a valid HTTP/HTTPS URL.")
os.Exit(1)
}

if *cc < 1 {
fmt.Printf("Invalid concurrency level: %d. Must be at least 1.", *cc)
os.Exit(1)
}

fmt.Printf("Config OK. URL: %s, Max zoom: %d, Concurrency: %d\n\n", *url, *zoom, *cc)
// check the provided configuration
checkConfig(*url, *zoom, *cc)

// run the primer
prime(*url, *zoom, *cc, headers)
Expand Down

0 comments on commit b2172d6

Please sign in to comment.