-
Notifications
You must be signed in to change notification settings - Fork 10
/
main.go
60 lines (47 loc) · 1.28 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
54
55
56
57
58
59
60
package main
import (
"fmt"
"soarca/internal/controller"
"soarca/logger"
"soarca/routes/status"
"soarca/swaggerdocs"
"soarca/utils"
"github.com/joho/godotenv"
)
var log *logger.Log
func init() {
log = logger.Logger("MAIN", logger.Info, "", logger.Json)
}
var (
Version string
Buildtime string
Host string
)
const banner = `
_____ ____ _____ _____
/ ____|/ __ \ /\ | __ \ / ____| /\
| (___ | | | | / \ | |__) | | / \
\___ \| | | |/ /\ \ | _ /| | / /\ \
____) | |__| / ____ \| | \ \| |____ / ____ \
|_____/ \____/_/ \_\_| \_\\_____/_/ \_\
`
// @title SOARCA API
// @version 1.0.0
func main() {
fmt.Print(banner)
log.Info("Version: ", Version)
log.Info("Buildtime: ", Buildtime)
errenv := godotenv.Load(".env")
if errenv != nil {
log.Warning("Failed to read env variable, but will continue")
}
Host = "localhost:" + utils.GetEnv("PORT", "8080")
swaggerdocs.SwaggerInfo.Host = Host
// Version is only available here
status.SetVersion(Version)
errinit := controller.Initialize()
if errinit != nil {
log.Fatal("Something Went wrong with setting-up the app, msg: ", errinit)
panic(errinit)
}
}