-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
38 lines (30 loc) · 1007 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
38
package main
import (
"flag"
"os"
log "github.com/sirupsen/logrus"
"gopkg.in/ini.v1"
)
func main() {
var flagConfig = flag.String("config", "config.ini", "Configuration file to use")
// Set up commandline flags
flag.Parse()
cfg, err := ini.Load(*flagConfig)
if err != nil {
log.Fatalf("Fail to read configuration file: %v", err)
os.Exit(1)
}
log.Info("Data Path: ", cfg.Section("paths").Key("content").String())
log.Info("Templates Path: ", cfg.Section("paths").Key("templates").String())
log.Info("Server Port: ", cfg.Section("server").Key("port").String())
log.Info("Server Domain: ", cfg.Section("server").Key("domain").String())
log.Info("Server Host: ", cfg.Section("server").Key("host").String())
sv := NewGopherServer(
cfg.Section("server").Key("port").String(),
cfg.Section("server").Key("domain").String(),
cfg.Section("server").Key("host").String(),
cfg.Section("paths").Key("content").String(),
cfg.Section("paths").Key("templates").String(),
)
sv.Run()
}