()
| 40 | ) |
| 41 | |
| 42 | func main() { |
| 43 | var ( |
| 44 | clusterConfigPath string |
| 45 | clusterUID string |
| 46 | probesPath string |
| 47 | queueURL string |
| 48 | userContainerPort int |
| 49 | apiName string |
| 50 | jobID string |
| 51 | statsdAddress string |
| 52 | apiKind string |
| 53 | adminPort int |
| 54 | workers int |
| 55 | ) |
| 56 | flag.StringVar(&clusterConfigPath, "cluster-config", "", "cluster config path") |
| 57 | flag.StringVar(&clusterUID, "cluster-uid", "", "cluster unique identifier") |
| 58 | flag.StringVar(&probesPath, "probes-path", "", "path to the probes spec") |
| 59 | flag.StringVar(&queueURL, "queue", "", "target queue URL from which the api messages will be dequeued") |
| 60 | flag.StringVar(&apiKind, "api-kind", "", fmt.Sprintf("api kind (%s|%s)", userconfig.BatchAPIKind.String(), userconfig.AsyncAPIKind.String())) |
| 61 | flag.StringVar(&apiName, "api-name", "", "api name") |
| 62 | flag.StringVar(&jobID, "job-id", "", "job ID") |
| 63 | flag.StringVar(&statsdAddress, "statsd-address", "", "address to push statsd metrics") |
| 64 | flag.IntVar(&userContainerPort, "user-port", 8080, "target port to which the dequeued messages will be sent to") |
| 65 | flag.IntVar(&adminPort, "admin-port", 0, "port where the admin server (for the probes) will be exposed") |
| 66 | flag.IntVar(&workers, "workers", 1, "number of workers pulling from the queue") |
| 67 | |
| 68 | flag.Parse() |
| 69 | |
| 70 | version := os.Getenv("CORTEX_VERSION") |
| 71 | if version == "" { |
| 72 | version = consts.CortexVersion |
| 73 | } |
| 74 | |
| 75 | log := logging.GetLogger() |
| 76 | defer func() { |
| 77 | _ = log.Sync() |
| 78 | }() |
| 79 | |
| 80 | switch { |
| 81 | case clusterConfigPath == "": |
| 82 | log.Fatal("--cluster-config is a required option") |
| 83 | case probesPath == "": |
| 84 | log.Fatal("--probes-path is a required option") |
| 85 | case queueURL == "": |
| 86 | log.Fatal("--queue is a required option") |
| 87 | case apiName == "": |
| 88 | log.Fatal("--api-name is a required option") |
| 89 | case apiKind == "": |
| 90 | log.Fatal("--api-kind is a required option") |
| 91 | case adminPort == 0: |
| 92 | log.Fatal("--admin-port is a required option") |
| 93 | } |
| 94 | |
| 95 | targetURL := "http://127.0.0.1:" + strconv.Itoa(userContainerPort) |
| 96 | |
| 97 | clusterConfig, err := clusterconfig.NewForFile(clusterConfigPath) |
| 98 | if err != nil { |
| 99 | exit(log, err) |
nothing calls this directly
no test coverage detected