-
Notifications
You must be signed in to change notification settings - Fork 0
/
igo.go
57 lines (48 loc) · 816 Bytes
/
igo.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
package igo
import (
"github.com/aichy126/igo/cache"
"github.com/aichy126/igo/config"
"github.com/aichy126/igo/db"
"github.com/aichy126/igo/log"
"github.com/aichy126/igo/web"
)
type Application struct {
Conf *config.Config
Web *web.Web
DB *db.DB
Cache *cache.Cache
}
var App *Application
func NewApp(ConfigPath string) *Application {
a := new(Application)
//config
conf, err := config.NewConfig(ConfigPath)
if err != nil {
panic(err)
}
a.Conf = conf
//web
web, err := web.NewWeb(conf)
if err != nil {
panic(err)
}
a.Web = web
//log
_, err = log.NewLog(conf)
if err != nil {
panic(err)
}
//db
db, err := db.NewDb(conf)
if err != nil {
panic(err)
}
a.DB = db
//cahce
cache, err := cache.NewCache(conf)
if err != nil {
panic(err)
}
a.Cache = cache
return a
}