switched timeout to config flag
This commit is contained in:
@@ -2,4 +2,6 @@ logging:
|
|||||||
level: DEBUG
|
level: DEBUG
|
||||||
|
|
||||||
station_ip: "ip here"
|
station_ip: "ip here"
|
||||||
password: "password here"
|
password: "password here"
|
||||||
|
|
||||||
|
timeout: "100s"
|
8
main.go
8
main.go
@@ -30,6 +30,7 @@ type Conf struct {
|
|||||||
}
|
}
|
||||||
StationIP string `yaml:"station_ip"`
|
StationIP string `yaml:"station_ip"`
|
||||||
Password string `yaml:"password"`
|
Password string `yaml:"password"`
|
||||||
|
Timeout string `yaml:"timeout"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -184,8 +185,13 @@ func main() {
|
|||||||
log.Fatalf("error creating jar")
|
log.Fatalf("error creating jar")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
timeout, err := time.ParseDuration(conf.Timeout)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf("unable to parse duration %s: %v", conf.Timeout, err)
|
||||||
|
}
|
||||||
|
|
||||||
httpClient = &http.Client{
|
httpClient = &http.Client{
|
||||||
Timeout: time.Second * 30,
|
Timeout: timeout,
|
||||||
Jar: cj,
|
Jar: cj,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user