-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
46 lines (40 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
39
40
41
42
43
44
45
46
package main
import (
"github.com/sirupsen/logrus"
"hextechdocs-be/configuration"
"hextechdocs-be/flags"
"hextechdocs-be/importer"
"hextechdocs-be/logger"
"hextechdocs-be/logger/hooks"
"hextechdocs-be/model"
"hextechdocs-be/web"
)
func main() {
logger.InitLogger()
logger.HexLogger.Info("HextechDocs Backend")
flags.InitFlags()
config, err := configuration.InitializeConfiguration()
if err != nil {
logger.HexLogger.WithFields(logrus.Fields{
"error": err,
}).Fatal("Unable to fetch configuration! The process will terminate!")
return
}
if config.ShouldLogToElastic {
hooks.AddElasticHook(config)
}
err = model.Init(config)
if err != nil {
logger.HexLogger.WithFields(logrus.Fields{
"error": err,
}).Fatal("Unable to connect to the database! The process will terminate!")
return
}
if flags.Importer {
logger.HexLogger.Info("Launching in importer mode")
importer.ParseFolders()
} else {
logger.HexLogger.Info("Launching in web mode")
web.ServeWeb()
}
}