-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
25 lines (22 loc) · 743 Bytes
/
main.go
File metadata and controls
25 lines (22 loc) · 743 Bytes
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
package main
import (
"bash-runtime/common"
"bash-runtime/runner"
"github.com/sirupsen/logrus"
"os"
)
func main() {
pulsarUrl := common.GetEnv("PULSAR_URL", "pulsar://localhost:6650")
outTopic := common.GetEnv("OUT_TOPIC", "bash-runtime-out")
logTopic := common.GetEnv("LOG_TOPIC", "bash-runtime-log")
inTopics := common.GetEnv("IN_TOPICS", "bash-runtime-in")
subscription := common.GetEnv("SUBSCRIPTION", "bash-runtime-sub")
script := common.GetEnv("SCRIPT", "./scripts/exec.sh")
scriptRunner, err := runner.NewRunner(pulsarUrl, logTopic, inTopics, subscription, outTopic)
if err != nil {
logrus.Errorf("Failed to initialize script runner: %s", err)
os.Exit(1)
}
defer scriptRunner.Close()
_ = scriptRunner.Run(script)
}