feat:config:force existing users to opt into new defaults (#10488)
* Config default does not comment out EnableSplitstore * Loadability check * Remove test used for debugging * regexp for properly safe check that config is set * regexp for safely matching the EnableSpitstore field in the config * Add instructions for undeleting config and remind users to set splitstore false for full archive * UpdateConfig small docs and functional opts * make gen * Lint * Fix * nil pointer check on validate * Unit testing of EnableSplitstore cases * Address Review --------- Co-authored-by: zenground0 <ZenGround0@users.noreply.github.com>
This commit is contained in:
@@ -31,7 +31,7 @@ var configDefaultCmd = &cli.Command{
|
||||
Action: func(cctx *cli.Context) error {
|
||||
c := config.DefaultStorageMiner()
|
||||
|
||||
cb, err := config.ConfigUpdate(c, nil, !cctx.Bool("no-comment"))
|
||||
cb, err := config.ConfigUpdate(c, nil, config.Commented(!cctx.Bool("no-comment")))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -83,7 +83,7 @@ var configUpdateCmd = &cli.Command{
|
||||
|
||||
cfgDef := config.DefaultStorageMiner()
|
||||
|
||||
updated, err := config.ConfigUpdate(cfgNode, cfgDef, !cctx.Bool("no-comment"))
|
||||
updated, err := config.ConfigUpdate(cfgNode, cfgDef, config.Commented(!cctx.Bool("no-comment")))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ func restore(ctx context.Context, cctx *cli.Context, targetPath string, strConfi
|
||||
return
|
||||
}
|
||||
|
||||
ff, err := config.FromFile(cf, rcfg)
|
||||
ff, err := config.FromFile(cf, config.SetDefault(func() (interface{}, error) { return rcfg, nil }))
|
||||
if err != nil {
|
||||
cerr = xerrors.Errorf("loading config: %w", err)
|
||||
return
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ func restore(cctx *cli.Context, r repo.Repo) error {
|
||||
return
|
||||
}
|
||||
|
||||
ff, err := config.FromFile(cf, rcfg)
|
||||
ff, err := config.FromFile(cf, config.SetDefault(func() (interface{}, error) { return rcfg, nil }))
|
||||
if err != nil {
|
||||
cerr = xerrors.Errorf("loading config: %w", err)
|
||||
return
|
||||
|
||||
+2
-2
@@ -31,7 +31,7 @@ var configDefaultCmd = &cli.Command{
|
||||
Action: func(cctx *cli.Context) error {
|
||||
c := config.DefaultFullNode()
|
||||
|
||||
cb, err := config.ConfigUpdate(c, nil, !cctx.Bool("no-comment"))
|
||||
cb, err := config.ConfigUpdate(c, nil, config.Commented(!cctx.Bool("no-comment")), config.DefaultKeepUncommented())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -83,7 +83,7 @@ var configUpdateCmd = &cli.Command{
|
||||
|
||||
cfgDef := config.DefaultFullNode()
|
||||
|
||||
updated, err := config.ConfigUpdate(cfgNode, cfgDef, !cctx.Bool("no-comment"))
|
||||
updated, err := config.ConfigUpdate(cfgNode, cfgDef, config.Commented(!cctx.Bool("no-comment")), config.DefaultKeepUncommented())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user