Skip to content

Commit

Permalink
fix(build): check for env vars in all dirs (#12652)
Browse files Browse the repository at this point in the history
Signed-off-by: Anton Gilgur <agilgur5@gmail.com>
  • Loading branch information
agilgur5 committed Feb 11, 2024
1 parent 5c3c9a1 commit 66680f1
Show file tree
Hide file tree
Showing 56 changed files with 98 additions and 94 deletions.
2 changes: 1 addition & 1 deletion cmd/argo/commands/client/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func AddAPIClientFlagsToCmd(cmd *cobra.Command) {
cmd.PersistentFlags().StringVar(&instanceID, "instanceid", os.Getenv("ARGO_INSTANCEID"), "submit with a specific controller's instance id label. Default to the ARGO_INSTANCEID environment variable.")
// "-s" like kubectl
cmd.PersistentFlags().StringVarP(&ArgoServerOpts.URL, "argo-server", "s", os.Getenv("ARGO_SERVER"), "API server `host:port`. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.")
cmd.PersistentFlags().StringVar(&ArgoServerOpts.Path, "argo-base-href", os.Getenv("ARGO_BASE_HREF"), "An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.")
cmd.PersistentFlags().StringVar(&ArgoServerOpts.Path, "argo-base-href", os.Getenv("ARGO_BASE_HREF"), "Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.")
cmd.PersistentFlags().BoolVar(&ArgoServerOpts.HTTP1, "argo-http1", os.Getenv("ARGO_HTTP1") == "true", "If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.")
cmd.PersistentFlags().StringSliceVarP(&ArgoServerOpts.Headers, "header", "H", []string{}, "Sets additional header to all requests made by Argo CLI. (Can be repeated multiple times to add multiple headers, also supports comma separated headers) Used only when either ARGO_HTTP1 or --argo-http1 is set to true.")
// "-e" for encrypted - like zip
Expand Down
16 changes: 1 addition & 15 deletions cmd/argo/commands/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import (
"context"
"crypto/tls"
"fmt"
"net/http"
"os"
"reflect"
"strconv"
"strings"
"time"

Expand Down Expand Up @@ -188,18 +186,6 @@ See %s`, help.ArgoServer),
return err
}

// disabled by default, for security
if x, enabled := os.LookupEnv("ARGO_SERVER_PPROF"); enabled {
port, err := strconv.Atoi(x)
if err != nil {
return err
}
go func() {
log.Infof("starting server for pprof on :%d, see https://golang.org/pkg/net/http/pprof/", port)
log.Println(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
}()
}

server.Run(ctx, port, browserOpenFunc)
return nil
},
Expand Down Expand Up @@ -232,7 +218,7 @@ See %s`, help.ArgoServer),
command.Flags().StringVar(&frameOptions, "x-frame-options", "DENY", "Set X-Frame-Options header in HTTP responses.")
command.Flags().StringVar(&accessControlAllowOrigin, "access-control-allow-origin", "", "Set Access-Control-Allow-Origin header in HTTP responses.")
command.Flags().Uint64Var(&apiRateLimit, "api-rate-limit", 1000, "Set limit per IP for api ratelimiter")
command.Flags().StringArrayVar(&allowedLinkProtocol, "allowed-link-protocol", defaultAllowedLinkProtocol, "Allowed link protocol in configMap. Used if the allowed configMap links protocol are different from http,https. Defaults to the environment variable ALLOWED_LINK_PROTOCOL")
command.Flags().StringArrayVar(&allowedLinkProtocol, "allowed-link-protocol", defaultAllowedLinkProtocol, "Allowed protocols for links feature. Defaults to the environment variable ALLOWED_LINK_PROTOCOL: http,https")
command.Flags().StringVar(&logFormat, "log-format", "text", "The formatter to use for logs. One of: text|json")
command.Flags().Float32Var(&kubeAPIQPS, "kube-api-qps", 20.0, "QPS to use while talking with kube-apiserver.")
command.Flags().IntVar(&kubeAPIBurst, "kube-api-burst", 30, "Burst to use while talking with kube-apiserver.")
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ argo [flags]
### Options

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ argo archive [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ argo archive delete UID... [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ argo archive get UID [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_list-label-keys.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ argo archive list-label-keys [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_list-label-values.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ argo archive list-label-values [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ argo archive list [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_resubmit.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ argo archive resubmit [WORKFLOW...] [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_archive_retry.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ argo archive retry [WORKFLOW...] [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_auth.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ argo auth [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_auth_token.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ argo auth token [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ argo cluster-template [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ argo cluster-template create FILE1 FILE2... [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ argo cluster-template delete WORKFLOW_TEMPLATE [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ argo cluster-template get CLUSTER WORKFLOW_TEMPLATE... [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template_lint.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ argo cluster-template lint FILE... [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cluster-template_list.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ argo cluster-template list [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_completion.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ argo completion SHELL [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cp.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ argo cp my-wf output-directory ... [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cron.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ argo cron [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cron_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ argo cron create FILE1 FILE2... [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cron_delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ argo cron delete [CRON_WORKFLOW... | --all] [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down
2 changes: 1 addition & 1 deletion docs/cli/argo_cron_get.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ argo cron get CRON_WORKFLOW... [flags]
### Options inherited from parent commands

```
--argo-base-href string An path to use with HTTP client (e.g. due to BASE_HREF). Defaults to the ARGO_BASE_HREF environment variable.
--argo-base-href string Path to use with HTTP client due to BASE_HREF. Defaults to the ARGO_BASE_HREF environment variable.
--argo-http1 If true, use the HTTP client. Defaults to the ARGO_HTTP1 environment variable.
-s, --argo-server host:port API server host:port. e.g. localhost:2746. Defaults to the ARGO_SERVER environment variable.
--as string Username to impersonate for the operation
Expand Down

0 comments on commit 66680f1

Please sign in to comment.