capture/args.go

30 lines
721 B
Go
Raw Normal View History

2017-11-08 00:10:54 +01:00
package main
import (
"flag"
2017-11-18 12:05:41 +01:00
"net/url"
2017-11-08 00:10:54 +01:00
"strconv"
)
2018-07-21 19:50:53 +02:00
type Args struct {
url *url.URL
port string
dashboard string
maxCaptures int
}
var args Args
func parseArgs() {
proxyURL := flag.String("url", "https://jsonplaceholder.typicode.com", "Required. Set the base url you want to capture")
2017-11-18 12:05:41 +01:00
proxyPort := flag.Int("port", 9000, "Set the proxy port")
2017-11-08 00:10:54 +01:00
dashboard := flag.String("dashboard", "dashboard", "Set the dashboard name")
2017-11-18 12:05:41 +01:00
maxCaptures := flag.Int("max-captures", 16, "Set the max number of captures to show in the dashboard")
2017-11-08 00:10:54 +01:00
flag.Parse()
2018-07-21 19:50:53 +02:00
args = Args{}
args.url, _ = url.Parse(*proxyURL)
args.port = strconv.Itoa(*proxyPort)
args.dashboard = *dashboard
args.maxCaptures = *maxCaptures
2017-11-08 00:10:54 +01:00
}