-
Notifications
You must be signed in to change notification settings - Fork 0
/
fioviewer.go
37 lines (26 loc) · 910 Bytes
/
fioviewer.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Copyright 2017 Richard Hillmann. All rights reserved.
// Use of this source code is governed by a MIT style
// license that can be found in the LICENSE file.
package main
import (
"flag"
gin "gopkg.in/gin-gonic/gin.v1"
"github.com/project0/fioviewer/pkg/api"
"github.com/project0/fioviewer/pkg/fiolog"
)
func main() {
dir := flag.String("dir", ".", "Path to the fio log files")
listen := flag.String("listen", ":8080", "Listen to this ip:port")
staticDir := flag.String("static", ".", "Path to the static (dist) files of the WebUI")
flag.Parse()
fiolog.Register(dir)
gin.SetMode(gin.DebugMode)
router := gin.Default()
// Serve static files for UI components.
router.StaticFile("/index.html", *staticDir+"/index.html")
router.StaticFile("/", *staticDir+"/index.html")
router.Static("/static/", *staticDir+"/static/")
// add api routes
api.Register(router)
router.Run(*listen)
}