Display config details after oauth2
After a new oauth2 authorization, the configuration details are
displayed even when the 'safe_mode' option is set.
--- a/cmd/config.go Sun Jan 13 12:28:07 2019 +0100
+++ b/cmd/config.go Sun Jan 13 12:33:24 2019 +0100
@@ -43,7 +43,7 @@
Short: "Dump the configuration",
Example: ` madonctl config dump -i INSTANCE -L USERNAME -P PASS > config.yaml`,
RunE: func(cmd *cobra.Command, args []string) error {
- return configDump()
+ return configDump(false)
},
},
&cobra.Command{
@@ -84,8 +84,8 @@
...
`
-func configDump() error {
- if viper.GetBool("safe_mode") {
+func configDump(force bool) error {
+ if !force && viper.GetBool("safe_mode") {
errPrint("Cannot dump: disabled by configuration (safe_mode)")
return nil
}
--- a/cmd/oauth2.go Sun Jan 13 12:28:07 2019 +0100
+++ b/cmd/oauth2.go Sun Jan 13 12:33:24 2019 +0100
@@ -88,7 +88,7 @@
if gClient.UserToken != nil {
errPrint("Login successful.\n")
- configDump()
+ configDump(true)
}
return nil
}