-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
53 lines (40 loc) · 1.16 KB
/
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"fmt"
"image"
"image/png"
"os"
"github.com/icpac-igad/timeseries-mbgl-maps/internal/conf"
"github.com/icpac-igad/timeseries-mbgl-maps/internal/service"
"github.com/pborman/getopt/v2"
log "github.com/sirupsen/logrus"
)
var flagDebugOn bool
var flagVersion bool
var flagConfigFilename string
var flagWmsFontPath string
func init() {
initCommandOptions()
}
func initCommandOptions() {
getopt.FlagLong(&flagConfigFilename, "config", 'c', "", "config file name")
getopt.FlagLong(&flagDebugOn, "debug", 'd', "Set logging level to TRACE")
getopt.FlagLong(&flagWmsFontPath, "font", 'f', "Font file path")
getopt.FlagLong(&flagVersion, "version", 'v', "Output the version information")
}
func main() {
getopt.Parse()
if flagVersion {
fmt.Printf("%s %s\n", conf.AppConfig.Name, conf.AppConfig.Version)
os.Exit(1)
}
log.Infof("---- %s - Version %s ----------\n", conf.AppConfig.Name, conf.AppConfig.Version)
conf.InitConfig(flagConfigFilename)
if flagDebugOn {
log.SetLevel(log.TraceLevel)
log.Debugf("Log level = DEBUG\n")
}
image.RegisterFormat("png", "png", png.Decode, png.DecodeConfig)
// start the web service
service.Serve()
}