Skip to content

Commit 04ce2af

Browse files
authored
Allow to get the network settings over ENV (#10)
1 parent 69b3928 commit 04ce2af

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

main.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,15 @@ func main() {
2727
panic(err)
2828
}
2929

30+
// Generate Network check
31+
networkMask := "172.30.32.0/23"
32+
if env := os.Getenv("NETWORK_MASK"); env != "" {
33+
networkMask = env
34+
}
35+
_, hassioNetwork, _ = net.ParseCIDR(networkMask)
36+
37+
// system settings
3038
apiKey = os.Getenv("SUPERVISOR_TOKEN")
31-
_, hassioNetwork, _ = net.ParseCIDR("172.30.32.0/23")
3239
development = (os.Getenv("DEVELOPMENT") == "True")
3340
httpClient = http.Client{Timeout: 3 * time.Second}
3441

@@ -40,6 +47,7 @@ func main() {
4047

4148
indexTemplate = template.Must(template.ParseFiles(wwwRoot + "/index.html"))
4249

50+
// API setup
4351
http.HandleFunc("/", statusIndex)
4452
http.HandleFunc("/ping", apiPing)
4553
http.HandleFunc("/logs", apiLogs)

0 commit comments

Comments
 (0)