in src/go/cmd/edasim/worker/main.go [48:118]
func initializeApplicationVariables(ctx context.Context) (*azure.EventHubSender, string, string, string, []string, int) {
var enableDebugging = flag.Bool("enableDebugging", false, "enable debug logging")
var uniqueName = flag.String("uniqueName", "", "the unique name to avoid queue collisions")
var mountPathsCSV = flag.String("mountPathsCSV", "", "one mount paths separated by commas")
var threadCount = flag.Int("threadCount", 16, "the count of worker threads")
flag.Parse()
if *enableDebugging {
log.EnableDebugging()
}
if envVarsAvailable := verifyEnvVars(); !envVarsAvailable {
usage()
os.Exit(1)
}
storageAccount := cli.GetEnv(azure.AZURE_STORAGE_ACCOUNT)
storageKey := cli.GetEnv(azure.AZURE_STORAGE_ACCOUNT_KEY)
eventHubSenderName := cli.GetEnv(azure.AZURE_EVENTHUB_SENDERKEYNAME)
eventHubSenderKey := cli.GetEnv(azure.AZURE_EVENTHUB_SENDERKEY)
eventHubNamespaceName := cli.GetEnv(azure.AZURE_EVENTHUB_NAMESPACENAME)
if len(*uniqueName) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: uniqueName is not specified\n")
usage()
os.Exit(1)
}
if len(*mountPathsCSV) == 0 {
fmt.Fprintf(os.Stderr, "ERROR: mountPathsCSV is not specified\n")
usage()
os.Exit(1)
}
mountPaths := strings.Split(*mountPathsCSV, ",")
for _, path := range mountPaths {
if _, err := os.Stat(path); os.IsNotExist(err) {
fmt.Fprintf(os.Stderr, "ERROR: mountPath '%s' does not exist\n", path)
usage()
os.Exit(1)
} else if err != nil {
fmt.Fprintf(os.Stderr, "ERROR: error encountered with path '%s': %v\n", path, err)
usage()
os.Exit(1)
}
}
azure.FatalValidateQueueName(*uniqueName)
if *threadCount < 0 {
fmt.Fprintf(os.Stderr, "ERROR: there must be at least 1 thread to submit jobs")
usage()
os.Exit(1)
}
eventHub := edasim.InitializeReaderWriters(
ctx,
eventHubSenderName,
eventHubSenderKey,
eventHubNamespaceName,
edasim.GetEventHubName(*uniqueName))
return eventHub,
storageAccount,
storageKey,
*uniqueName,
mountPaths,
*threadCount
}