-
Notifications
You must be signed in to change notification settings - Fork 51
/
app.go
43 lines (36 loc) · 1019 Bytes
/
app.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
package main
import (
"fmt"
"math/rand"
"time"
"github.com/lotteryjs/ten-minutes-app/config"
"github.com/lotteryjs/ten-minutes-app/database"
"github.com/lotteryjs/ten-minutes-app/mode"
"github.com/lotteryjs/ten-minutes-app/model"
"github.com/lotteryjs/ten-minutes-app/router"
"github.com/lotteryjs/ten-minutes-app/runner"
)
var (
// Version the version of TMA.
Version = "unknown"
// Commit the git commit hash of this version.
Commit = "unknown"
// BuildDate the date on which this binary was build.
BuildDate = "unknown"
// Mode the build mode
Mode = mode.Dev
)
func main() {
vInfo := &model.VersionInfo{Version: Version, Commit: Commit, BuildDate: BuildDate}
mode.Set(Mode)
fmt.Println("Starting TMA version", vInfo.Version+"@"+BuildDate)
rand.Seed(time.Now().UnixNano())
conf := config.Get()
db, err := database.New(conf.Database.Connection, conf.Database.Dbname)
if err != nil {
panic(err)
}
defer db.Close()
engine := router.Create(db, vInfo, conf)
runner.Run(engine, conf)
}