summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go9
1 files changed, 6 insertions, 3 deletions
diff --git a/main.go b/main.go
index 35bacc1..3264134 100644
--- a/main.go
+++ b/main.go
@@ -15,10 +15,11 @@ import (
"text/template"
)
+var appdata string;
+
type RuntimeConfig struct {
Devices DevicesConfig
Web WebConfig
- Appdata string
}
type DevicesConfig struct {
@@ -33,9 +34,9 @@ type WebConfig struct {
func main() {
configPath := parseFlags()
c := parseConfig(configPath)
- http.HandleFunc("/", index(c.Devices, c.Appdata))
+ http.HandleFunc("/", index(c.Devices, appdata))
http.HandleFunc("/api", api())
- http.HandleFunc("/webiot.css", css(c.Appdata))
+ http.HandleFunc("/webiot.css", css(appdata))
fmt.Printf("Serving at http://%s\n", c.Web.Listen)
log.Fatal(http.ListenAndServe(c.Web.Listen.String(), nil))
}
@@ -47,6 +48,8 @@ func parseFlags() string {
flag.StringVar(&r, "c", "/etc/webiot/config.json",
"path to configuration file")
+ flag.StringVar(&appdata, "a", "/usr/share/webiot",
+ "path to static application data")
flag.Parse()
return r