Skip to content

Commit 52ceae3

Browse files
committed
Add configure --print CLI command
1 parent fced493 commit 52ceae3

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

cli/cmd/configure.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,18 @@ limitations under the License.
1717
package cmd
1818

1919
import (
20+
"fmt"
21+
2022
"github.com/spf13/cobra"
23+
24+
s "github.com/cortexlabs/cortex/pkg/lib/strings"
2125
)
2226

27+
var flagPrint bool
28+
2329
func init() {
2430
addEnvFlag(configureCmd)
31+
configureCmd.PersistentFlags().BoolVarP(&flagPrint, "print", "p", false, "print the configuration")
2532
}
2633

2734
var configureCmd = &cobra.Command{
@@ -33,6 +40,14 @@ in order to authenticate and send requests to Cortex.
3340
The configuration is stored in ~/.cortex.`,
3441
Args: cobra.NoArgs,
3542
Run: func(cmd *cobra.Command, args []string) {
43+
if flagPrint {
44+
cliConfig := getDefaults()
45+
fmt.Printf("Operator URL: %s\n", cliConfig.CortexURL)
46+
fmt.Printf("AWS Access Key ID: %s\n", cliConfig.AWSAccessKeyID)
47+
fmt.Printf("AWS Secret Access Key: %s\n", s.MaskString(cliConfig.AWSSecretAccessKey, 4))
48+
return
49+
}
50+
3651
configure()
3752
},
3853
}

docs/cluster/cli.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Usage:
106106
Flags:
107107
-e, --env string environment (default "default")
108108
-h, --help help for configure
109+
-p, --print print the configuration
109110
```
110111

111112
## support

0 commit comments

Comments
 (0)