forked from mdevilliers/redishappy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (33 loc) · 1.04 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
package main
import (
"flag"
"github.com/mdevilliers/redishappy"
"github.com/mdevilliers/redishappy/configuration"
"github.com/mdevilliers/redishappy/services/logger"
)
var configFile string
var logPath string
func init() {
flag.StringVar(&configFile, "config", "config.json", "Full path of the configuration JSON file.")
flag.StringVar(&logPath, "log", "log", "Folder for the logging folder.")
}
func main() {
flag.Parse()
logger.InitLogging(logPath)
config, err := configuration.LoadFromFile(configFile)
if err != nil {
logger.Error.Panicf("Error opening config file : %s", err.Error())
}
sane, errors := config.GetCurrentConfiguration().SanityCheckConfiguration(
&configuration.ConfigContainsRequiredSections{},
&configuration.CheckForObviousMisConfiguration{})
if !sane {
for _, errorAsStr := range errors {
logger.Error.Print(errorAsStr)
}
logger.Error.Panic("Configuration fails checks")
}
flipper := NewConsulFlipperClient(config)
engine := redishappy.NewRedisHappyEngine(flipper, config)
engine.Serve()
}