-
Notifications
You must be signed in to change notification settings - Fork 0
/
run.go
35 lines (32 loc) · 773 Bytes
/
run.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
package bund
import (
"github.com/pieterclaerhout/go-log"
tc "github.com/vulogov/ThreadComputation"
"github.com/vulogov/monitoringbund/internal/conf"
"github.com/vulogov/monitoringbund/internal/signal"
"github.com/vulogov/monitoringbund/internal/stdlib"
)
func RunFile(core *stdlib.BUNDEnv, name string) {
log.Debugf("Running: %v", name)
code, err := tc.ReadFile(name)
if err != nil {
log.Fatalf("Error loading file: %v", err)
}
core.Eval(code)
}
func Run() {
Init()
InitEtcdAgent("run")
UpdateLocalConfigFromEtcd()
InitNatsAgent()
if ! WaitSync() {
return
}
InitStoragePipe()
log.Debugf("[ MBUND ] bund.Run(%v) is reached", ApplicationId)
core := stdlib.InitBUND()
for _, f := range *conf.Scripts {
RunFile(core, f)
}
signal.ExitRequest()
}