-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.go
More file actions
47 lines (38 loc) · 919 Bytes
/
main.go
File metadata and controls
47 lines (38 loc) · 919 Bytes
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
package main
import (
"fmt"
"log"
"os"
"gitlab.com/codebox4073715/codebox/cli"
"gitlab.com/codebox4073715/codebox/config"
dbconn "gitlab.com/codebox4073715/codebox/db/connection"
)
// @title Codebox API
// @version {{version_placeholder}}
// @description Codebox server
// @license.name MIT
// @license.url https://mit-license.org
// @host localhost:8080
func main() {
err := config.InitCodeBoxEnv()
if err != nil {
log.Fatalf("Failed to load server configuration from environment: '%s'\n", err)
return
}
// test db connection
err = dbconn.ConnectDB()
if err != nil {
log.Fatalf("Cannot init connection with DB: '%s'\n", err)
return
}
// TODO: test redis connection
// parse cli args
args, err := cli.ParseCLIArgs()
if err != nil {
fmt.Println(err)
os.Exit(1)
return
}
// execute command and exit with status
os.Exit(int(cli.RunCommand(args)))
}