-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
47 lines (42 loc) · 967 Bytes
/
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
package main
import (
"context"
"github.com/capcom6/censor-tg-bot/internal/bot"
"github.com/capcom6/censor-tg-bot/internal/censor"
"github.com/capcom6/censor-tg-bot/internal/config"
"github.com/capcom6/censor-tg-bot/internal/storage"
"github.com/capcom6/go-infra-fx/logger"
"go.uber.org/fx"
"go.uber.org/fx/fxevent"
"go.uber.org/zap"
"go.uber.org/zap/zapcore"
)
var module = fx.Module(
"main",
fx.Invoke(func(lc fx.Lifecycle) {
lc.Append(fx.Hook{
OnStart: func(ctx context.Context) error {
return nil
},
OnStop: func(ctx context.Context) error {
return nil
},
})
// log.Debug("config", zap.Any("config", cfg))
}),
)
func main() {
fx.New(
fx.WithLogger(func(logger *zap.Logger) fxevent.Logger {
logOption := fxevent.ZapLogger{Logger: logger}
logOption.UseLogLevel(zapcore.DebugLevel)
return &logOption
}),
logger.Module,
config.Module,
censor.Module,
storage.Module,
bot.Module,
module,
).Run()
}