Added command line argument to set the capacity of the batteries used.

This commit is contained in:
Hendrik van Wyk
2015-02-28 15:16:29 +02:00
parent 1732b0c854
commit 70bdaa99eb

View File

@@ -41,11 +41,12 @@ import (
func main() { func main() {
url := flag.String("url", "http://localhost:9005", "The url of the multiplus JSON interface.") url := flag.String("url", "http://localhost:9005", "The url of the multiplus JSON interface.")
capacity := flag.Float64("capacity", 100, "The capacity of the batteries in the system.")
flag.Parse() flag.Parse()
source := datasource.NewJSONSource(*url) source := datasource.NewJSONSource(*url)
poller := datasource.NewDataPoller(source, 10*time.Second) poller := datasource.NewDataPoller(source, 10*time.Second)
gui := webgui.NewWebGui(poller, 100) gui := webgui.NewWebGui(poller, *capacity)
http.Handle("/", gui) http.Handle("/", gui)
http.Handle("/munin", http.HandlerFunc(gui.ServeMuninHTTP)) http.Handle("/munin", http.HandlerFunc(gui.ServeMuninHTTP))
http.Handle("/muninconfig", http.HandlerFunc(gui.ServeMuninConfigHTTP)) http.Handle("/muninconfig", http.HandlerFunc(gui.ServeMuninConfigHTTP))