-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
39 lines (31 loc) · 827 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
package main
import (
"flag"
"github.com/surajsub/terraform-temporal-stack/worker"
"github.com/surajsub/terraform-temporal-stack/workflows"
"log"
"os"
)
func main() {
if len(os.Args) < 2 {
log.Fatal("expected 'worker' or 'starter' subcommands")
}
switch os.Args[1] {
case "worker":
worker.RunWorker()
case "starter":
starterCmd := flag.NewFlagSet("starter", flag.ExitOnError)
vpcCdirBlock := starterCmd.String("vpcCdirBlock", "", "CIDR Block for the VPC")
err := starterCmd.Parse(os.Args[2:])
if err != nil {
log.Fatal("failed to parse 'starter' flags")
}
// Ensure the required flags are provided
if *vpcCdirBlock == "" {
log.Fatal("VPC Cdir block is not provided")
}
workflows.StartWorkflow(*vpcCdirBlock)
default:
log.Fatal("expected 'worker' or 'starter' subcommands")
}
}