extract webrootdir
This commit is contained in:
parent
16473e25cf
commit
853e54065c
12
README.md
12
README.md
@ -11,15 +11,17 @@ Also it's will push statistic informations to a influxdb.
|
|||||||
## Usage
|
## Usage
|
||||||
```
|
```
|
||||||
Usage of ./micro-daemon:
|
Usage of ./micro-daemon:
|
||||||
-aliases string
|
|
||||||
path aliases.json file (default "webroot/aliases.json")
|
|
||||||
-collectInterval int
|
-collectInterval int
|
||||||
interval for data collections (default 15)
|
interval for data collections (default 15)
|
||||||
-h string
|
-host string
|
||||||
path aliases.json file
|
path aliases.json file
|
||||||
-output string
|
-httpdir string
|
||||||
|
a implemented static file webserver (default "webroot")
|
||||||
|
-path-aliases string
|
||||||
|
path aliases.json file (default "webroot/aliases.json")
|
||||||
|
-path-nodes string
|
||||||
path nodes.json file (default "webroot/nodes.json")
|
path nodes.json file (default "webroot/nodes.json")
|
||||||
-p string
|
-port string
|
||||||
path aliases.json file (default "8080")
|
path aliases.json file (default "8080")
|
||||||
-saveInterval int
|
-saveInterval int
|
||||||
interval for data saving (default 60)
|
interval for data saving (default 60)
|
||||||
|
20
main.go
20
main.go
@ -23,23 +23,25 @@ var (
|
|||||||
respondDaemon *respond.Daemon
|
respondDaemon *respond.Daemon
|
||||||
nodes = models.NewNodes()
|
nodes = models.NewNodes()
|
||||||
aliases = models.NewNodes()
|
aliases = models.NewNodes()
|
||||||
|
listenAddr string
|
||||||
|
listenPort string
|
||||||
|
collectInterval time.Duration
|
||||||
|
httpDir string
|
||||||
outputNodesFile string
|
outputNodesFile string
|
||||||
outputAliasesFile string
|
outputAliasesFile string
|
||||||
collectInterval time.Duration
|
|
||||||
saveInterval time.Duration
|
saveInterval time.Duration
|
||||||
listenPort string
|
|
||||||
listenAddr string
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
var collectSeconds, saveSeconds int
|
var collectSeconds, saveSeconds int
|
||||||
|
|
||||||
flag.StringVar(&outputNodesFile, "output", "webroot/nodes.json", "path nodes.json file")
|
flag.StringVar(&listenAddr, "host", "", "path aliases.json file")
|
||||||
flag.StringVar(&outputAliasesFile, "aliases", "webroot/aliases.json", "path aliases.json file")
|
flag.StringVar(&listenPort, "port", "8080", "path aliases.json file")
|
||||||
flag.StringVar(&listenPort, "p", "8080", "path aliases.json file")
|
|
||||||
flag.StringVar(&listenAddr, "h", "", "path aliases.json file")
|
|
||||||
flag.IntVar(&saveSeconds, "saveInterval", 60, "interval for data saving")
|
|
||||||
flag.IntVar(&collectSeconds, "collectInterval", 15, "interval for data collections")
|
flag.IntVar(&collectSeconds, "collectInterval", 15, "interval for data collections")
|
||||||
|
flag.StringVar(&httpDir, "httpdir", "webroot", "a implemented static file webserver")
|
||||||
|
flag.StringVar(&outputNodesFile, "path-nodes", "webroot/nodes.json", "path nodes.json file")
|
||||||
|
flag.StringVar(&outputAliasesFile, "path-aliases", "webroot/aliases.json", "path aliases.json file")
|
||||||
|
flag.IntVar(&saveSeconds, "saveInterval", 60, "interval for data saving")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
collectInterval = time.Second * time.Duration(collectSeconds)
|
collectInterval = time.Second * time.Duration(collectSeconds)
|
||||||
@ -73,7 +75,7 @@ func main() {
|
|||||||
})
|
})
|
||||||
go respondDaemon.ListenAndSend(collectInterval)
|
go respondDaemon.ListenAndSend(collectInterval)
|
||||||
|
|
||||||
http.Handle("/", http.FileServer(http.Dir("webroot")))
|
http.Handle("/", http.FileServer(http.Dir(httpDir)))
|
||||||
//TODO bad
|
//TODO bad
|
||||||
log.Fatal(http.ListenAndServe(net.JoinHostPort(listenAddr, listenPort), nil))
|
log.Fatal(http.ListenAndServe(net.JoinHostPort(listenAddr, listenPort), nil))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user