-
Notifications
You must be signed in to change notification settings - Fork 20
/
environment.go
36 lines (30 loc) · 1.07 KB
/
environment.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package cmd
import (
"fmt"
"github.com/spf13/cobra"
)
func init() {
RootCmd.AddCommand(&cobra.Command{
Use: "environment",
Short: "Environment variables usage",
Long: `The exo CLI tool allows users to override some account configuration settings
by specifying shell environment variables. Here is the list of environment
variables supported:
* EXOSCALE_API_KEY: the Exoscale client API key
* EXOSCALE_API_SECRET: the Exoscale client API secret
* EXOSCALE_API_ENDPOINT: the Exoscale (Compute) API endpoint to use
Note: to override the current profile API credentials, *both* EXOSCALE_API_KEY
and EXOSCALE_API_SECRET variables have to be set.
`},
)
RootCmd.AddCommand(&cobra.Command{
Use: "env",
Hidden: true,
Run: func(_ *cobra.Command, _ []string) {
fmt.Printf("export EXOSCALE_API_KEY=%q\n", gCurrentAccount.Key)
fmt.Printf("export EXOSCALE_API_SECRET=%q\n", gCurrentAccount.Secret)
fmt.Printf("export EXOSCALE_API_ENDPOINT=%q\n", gCurrentAccount.Endpoint)
fmt.Printf("export EXOSCALE_API_ENVIRONMENT=%q\n", gCurrentAccount.Environment)
},
})
}