forked from genshen/ssh-web-console
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
37 lines (33 loc) · 765 Bytes
/
main.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
package main
import (
"flag"
"fmt"
"github.com/genshen/ssh-web-console/src/routers"
"github.com/genshen/ssh-web-console/src/utils"
"log"
"net/http"
)
var confFilePath string
var version bool
func init() {
flag.StringVar(&confFilePath, "config", "conf/config.yaml", "filepath of config file.")
flag.BoolVar(&version, "version", false, "show current version.")
}
func main() {
flag.Parse()
if version {
fmt.Println("v0.3.0")
return
}
if err := utils.InitConfig(confFilePath); err != nil {
log.Fatal("config error,", err)
return
}
routers.Register()
log.Println("listening on port ", utils.Config.Site.ListenAddr)
// listen http
if err := http.ListenAndServe(utils.Config.Site.ListenAddr, nil); err != nil {
log.Fatal(err)
return
}
}