Skip to content

fix(cmd): resolve db command data-dir and verbosity from config#5516

Closed
gacevicljubisa wants to merge 1 commit into
masterfrom
fix/db-cmd-config-resolution
Closed

fix(cmd): resolve db command data-dir and verbosity from config#5516
gacevicljubisa wants to merge 1 commit into
masterfrom
fix/db-cmd-config-resolution

Conversation

@gacevicljubisa

Copy link
Copy Markdown
Member

Checklist

  • I have read the coding guide.
  • My change requires a documentation update, and I have done it.
  • I have added tests to cover my changes.
  • I have filled out the description and linked the related issues.

Description

bee db <cmd> --config=... failed with no data-dir provided because the db subcommands read flags directly and ignored the loaded config file.

  • Bind each db subcommand's flags to viper in PreRunE (composing with the root's config load, like start/init do).
  • Resolve data-dir and verbosity via c.config, so both follow the usual precedence: flag → env → config file.
  • Factor the repeated logger/data-dir boilerplate into helpers.

Result:

bee db nuke --config=config.sepolia.yaml   # now reuses data-dir from config

An explicit --data-dir/--verbosity still wins; an empty data-dir is the only required-key check. Added tests for config fallback, flag-over-config precedence, and the required-key error.

Open API Spec Version Changes (if applicable)

Motivation and Context (Optional)

The db maintenance commands should reuse the same config file as the node so operators don't have to re-pass --data-dir that already lives in their config.

Related Issue (Optional)

Screenshots (if appropriate):

AI Disclosure

  • This PR contains code that has been generated by an LLM.
  • I have reviewed the AI generated code thoroughly.
  • I possess the technical expertise to responsibly review the code generated in this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant