-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram.go
More file actions
72 lines (65 loc) · 1.54 KB
/
program.go
File metadata and controls
72 lines (65 loc) · 1.54 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
"context"
"os"
"time"
"ximanager/sources/artificial"
"ximanager/sources/configuration"
"ximanager/sources/external"
"ximanager/sources/features"
"ximanager/sources/localization"
"ximanager/sources/metrics"
"ximanager/sources/metrics/collector"
"ximanager/sources/network"
"ximanager/sources/persistence"
"ximanager/sources/platform"
"ximanager/sources/repository"
"ximanager/sources/telegram"
"ximanager/sources/texting/format"
"ximanager/sources/texting/personality"
"ximanager/sources/throttler"
"ximanager/sources/tracing"
"go.uber.org/fx"
)
var (
version = "0.0.0"
buildTime = "1970-01-01"
startTime = time.Now()
)
func main() {
platform.SetAppManifest(version, buildTime, startTime)
if tz := os.Getenv("TZ"); tz != "" {
if loc, err := time.LoadLocation(tz); err == nil {
time.Local = loc
}
}
fx.New(
metrics.Module,
collector.Module,
tracing.Module,
configuration.Module,
external.Module,
network.Module,
persistence.Module,
repository.Module,
throttler.Module,
features.Module,
localization.Module,
format.Module,
personality.Module,
artificial.Module,
telegram.Module,
fx.Invoke(func(lc fx.Lifecycle, log *tracing.Logger) {
lc.Append(fx.Hook{
OnStart: func(ctx context.Context) error {
log.I("Emperor Xi started successfully", "version", version, "build_time", buildTime)
return nil
},
OnStop: func(ctx context.Context) error {
log.I("Emperor Xi stopped", "version", version, "build_time", buildTime)
return nil
},
})
}),
).Run()
}