-
Notifications
You must be signed in to change notification settings - Fork 20
/
main.go
60 lines (55 loc) · 1.61 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 (
"github.com/goal-web/application"
"github.com/goal-web/auth"
"github.com/goal-web/bloomfilter"
"github.com/goal-web/cache"
"github.com/goal-web/config"
"github.com/goal-web/console/inputs"
"github.com/goal-web/contracts"
"github.com/goal-web/database"
"github.com/goal-web/email"
"github.com/goal-web/encryption"
"github.com/goal-web/events"
"github.com/goal-web/filesystem"
"github.com/goal-web/goal/app/console"
"github.com/goal-web/goal/app/exceptions"
"github.com/goal-web/goal/app/providers"
config2 "github.com/goal-web/goal/config"
"github.com/goal-web/hashing"
"github.com/goal-web/queue"
"github.com/goal-web/ratelimiter"
"github.com/goal-web/redis"
"github.com/goal-web/serialization"
)
func main() {
env := config.NewToml(config.File("env.toml"))
app := application.Singleton(env.GetBool("app.debug"))
// 设置异常处理器
app.Singleton("exceptions.handler", func() contracts.ExceptionHandler {
return exceptions.NewHandler()
})
app.RegisterServices(
config.NewService(env, config2.GetConfigProviders()),
hashing.NewService(),
encryption.NewService(),
filesystem.NewService(),
serialization.NewService(),
events.NewService(),
providers.NewEvents(),
redis.NewService(),
cache.NewService(),
bloomfilter.NewService(),
auth.NewService(),
ratelimiter.NewService(),
console.NewService(),
database.NewService(),
email.NewService(),
providers.NewApp(),
queue.NewService(true),
//&signal.NewService(),
)
app.Call(func(console3 contracts.Console, input contracts.ConsoleInput) {
console3.Run(&inputs.StringArrayInput{ArgsArray: []string{"run"}})
})
}