Add examples and the ability to unset values to config set
@@ -41,6 +41,13 @@ func NewSetCommand(o *SetOptions) *cobra.Command {
Use: "set NAME [VALUE]",
Short: "Modify the configuration file",
Long: "Modify the Optimize Configuration file",
+
+ Example: `# Add an environment variable to the controller
+stormforge config set controller.default.env.FOOBAR example
+
+# Set the controller memory
+stormforge config set controller.default.resources.memory 512Mi`,
+
Args: cobra.RangeArgs(1, 2),
PreRun: func(cmd *cobra.Command, args []string) {
@@ -67,9 +74,15 @@ func (o *SetOptions) Complete(args []string) {
}
func (o *SetOptions) set() error {
+ if o.Value != "" {
if err := o.Config.Update(config.SetProperty(o.Key, o.Value)); err != nil {
return err
}
+ } else {
+ if err := o.Config.Update(config.UnsetProperty(o.Key)); err != nil {
+ return err
+ }
+ }
if err := o.Config.Write(); err != nil {
return err
