func main()

in cmd/apmtool/main.go [28:98]


func main() {
	commands := &Commands{}
	cmd := &cli.Command{
		Flags: []cli.Flag{
			&cli.BoolFlag{
				Name:    "verbose",
				Usage:   "print debugging messages about progress",
				Aliases: []string{"v"},
			},
			&cli.StringFlag{
				Name:        "url",
				Usage:       "set the Elasticsearch URL",
				Category:    "Elasticsearch",
				Value:       "",
				Sources:     cli.EnvVars("ELASTICSEARCH_URL"),
				Destination: &commands.cfg.ElasticsearchURL,
				Action: func(ctx context.Context, c *cli.Command, s string) error {
					return commands.cfg.InferElasticCloudURLs()
				},
			},
			&cli.StringFlag{
				Name:        "username",
				Usage:       "set the Elasticsearch username",
				Category:    "Elasticsearch",
				Value:       "elastic",
				Sources:     cli.EnvVars("ELASTICSEARCH_USERNAME"),
				Destination: &commands.cfg.Username,
			},
			&cli.StringFlag{
				Name:        "password",
				Usage:       "set the Elasticsearch password",
				Category:    "Elasticsearch",
				Sources:     cli.EnvVars("ELASTICSEARCH_PASSWORD"),
				Destination: &commands.cfg.Password,
			},
			&cli.StringFlag{
				Name:        "api-key",
				Usage:       "set the Elasticsearch API Key",
				Category:    "Elasticsearch",
				Sources:     cli.EnvVars("ELASTICSEARCH_API_KEY"),
				Destination: &commands.cfg.APIKey,
			},
			&cli.StringFlag{
				Name:        "apm-url",
				Usage:       "set the APM Server URL. Will be derived from the Elasticsearch URL for Elastic Cloud.",
				Category:    "APM",
				Value:       "",
				Sources:     cli.EnvVars("ELASTIC_APM_SERVER_URL"),
				Destination: &commands.cfg.APMServerURL,
			},
			&cli.BoolFlag{
				Name:        "insecure",
				Usage:       "skip TLS certificate verification of Elasticsearch and APM server",
				Value:       false,
				Sources:     cli.EnvVars("TLS_SKIP_VERIFY"),
				Destination: &commands.cfg.TLSSkipVerify,
			},
		},
		Commands: []*cli.Command{
			NewPrintEnvCmd(commands),
			NewSendEventCmd(commands),
			NewUploadSourcemapCmd(commands),
			NewListServiceCmd(commands),
			NewTraceGenCmd(commands),
			NewESPollCmd(commands),
		},
	}
	if err := cmd.Run(context.Background(), os.Args); err != nil {
		log.Fatal(err)
	}
}