cmd/config.go
changeset 244 a01bc98ae01a
parent 185 564d92b54b00
child 245 910f00ab2799
equal deleted inserted replaced
243:1bec7d3d6a85 244:a01bc98ae01a
    41 	&cobra.Command{
    41 	&cobra.Command{
    42 		Use:     "dump",
    42 		Use:     "dump",
    43 		Short:   "Dump the configuration",
    43 		Short:   "Dump the configuration",
    44 		Example: `  madonctl config dump -i INSTANCE -L USERNAME -P PASS > config.yaml`,
    44 		Example: `  madonctl config dump -i INSTANCE -L USERNAME -P PASS > config.yaml`,
    45 		RunE: func(cmd *cobra.Command, args []string) error {
    45 		RunE: func(cmd *cobra.Command, args []string) error {
    46 			return configDump()
    46 			return configDump(false)
    47 		},
    47 		},
    48 	},
    48 	},
    49 	&cobra.Command{
    49 	&cobra.Command{
    50 		Use:     "whoami",
    50 		Use:     "whoami",
    51 		Aliases: []string{"token"},
    51 		Aliases: []string{"token"},
    82 #color: auto
    82 #color: auto
    83 #verbose: false
    83 #verbose: false
    84 ...
    84 ...
    85 `
    85 `
    86 
    86 
    87 func configDump() error {
    87 func configDump(force bool) error {
    88 	if viper.GetBool("safe_mode") {
    88 	if !force && viper.GetBool("safe_mode") {
    89 		errPrint("Cannot dump: disabled by configuration (safe_mode)")
    89 		errPrint("Cannot dump: disabled by configuration (safe_mode)")
    90 		return nil
    90 		return nil
    91 	}
    91 	}
    92 
    92 
    93 	if err := madonInitClient(); err != nil {
    93 	if err := madonInitClient(); err != nil {