kumahq / kuma

🐻 The multi-zone service mesh for containers, Kubernetes and VMs. Built with Envoy. CNCF Sandbox Project.
https://kuma.io/install
Apache License 2.0
3.55k stars 326 forks source link

Show environment variables when printing command help #2109

Open jpeach opened 3 years ago

jpeach commented 3 years ago

Summary

When we print the command help, we should automatically show the environment variables that the command supports. I expect that Usagef is probably the right API for this and that we will want a custom template.

Here's a sample of the default table output:

KEY                                                         TYPE                                           DEFAULT    REQUIRED    DESCRIPTION
CONTROLPLANE_KUMA_CONTROL_PLANE_URL                         String                                                                
CONTROLPLANE_RETRY_KUMA_CONTROL_PLANE_RETRY_BACKOFF         Duration                                                              
CONTROLPLANE_RETRY_KUMA_CONTROL_PLANE_RETRY_MAX_DURATION    Duration                                                              
CONTROLPLANE_KUMA_CONTROL_PLANE_CA_CERT                     String                                                                
CONTROLPLANE_KUMA_CONTROL_PLANE_CA_CERT_FILE                String                                                                
DATAPLANE_KUMA_DATAPLANE_MESH                               String                                                                
DATAPLANE_KUMA_DATAPLANE_NAME                               String                                                                
...

Here's a sample of the default list output:

CONTROLPLANE_KUMA_CONTROL_PLANE_URL
  [description] 
  [type]        String
  [default]     
  [required]    
CONTROLPLANE_RETRY_KUMA_CONTROL_PLANE_RETRY_BACKOFF
  [description] 
  [type]        Duration
  [default]     
  [required]    
CONTROLPLANE_RETRY_KUMA_CONTROL_PLANE_RETRY_MAX_DURATION
  [description] 
  [type]        Duration
  [default]     
  [required]    
CONTROLPLANE_KUMA_CONTROL_PLANE_CA_CERT
  [description] 
  [type]        String
  [default]     
  [required]    
CONTROLPLANE_KUMA_CONTROL_PLANE_CA_CERT_FILE
  [description] 
  [type]        String
  [default]     
  [required]    
DATAPLANE_KUMA_DATAPLANE_MESH
  [description] 
  [type]        String
  [default]     
  [required]    
DATAPLANE_KUMA_DATAPLANE_NAME
  [description] 
  [type]        String
  [default]     
  [required]    
DATAPLANE_KUMA_DATAPLANE_ADMIN_PORT
  [description] 
  [type]        PortRange
  [default]     
  [required]    
...
tharun208 commented 3 years ago

Adding on this can we create a new struct for the flag with a Usage method associated with it. So, that we can update the flag struct to include fields like shorthand name, description, the env variable associated with the command, and other information and call the Usage method while declaring the flag.

github-actions[bot] commented 2 years ago

This issue was inactive for 30 days it will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant please comment on it promptly or attend the next triage meeting.

chris-aeviator commented 2 years ago

is there documentation about the environment variables available?

lahabana commented 2 years ago

Is this command in kumactl or kuma-cp? FWIW the config is there as well: https://kuma.io/docs/1.6.x/generated/kuma-cp/

github-actions[bot] commented 2 years ago

This issue was inactive for 30 days it will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant please comment on it promptly or attend the next triage meeting.

github-actions[bot] commented 2 years ago

This issue was inactive for 30 days it will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant please comment on it promptly or attend the next triage meeting.

github-actions[bot] commented 1 year ago

This issue was inactive for 30 days it will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant please comment on it promptly or attend the next triage meeting.

github-actions[bot] commented 1 year ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] commented 1 year ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] commented 1 year ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] commented 11 months ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] commented 8 months ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] commented 5 months ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.

github-actions[bot] commented 2 months ago

This issue was inactive for 90 days. It will be reviewed in the next triage meeting and might be closed. If you think this issue is still relevant, please comment on it or attend the next triage meeting.