Skip to content

feat(cli): add --rpc-url/--admin-url flags and fix --data-dir targeting#394

Open
ezeike wants to merge 3 commits into
mainfrom
feat/cli-url-flags-and-data-dir-fix
Open

feat(cli): add --rpc-url/--admin-url flags and fix --data-dir targeting#394
ezeike wants to merge 3 commits into
mainfrom
feat/cli-url-flags-and-data-dir-fix

Conversation

@ezeike
Copy link
Copy Markdown
Contributor

@ezeike ezeike commented May 12, 2026

Summary

  • Fix --data-dir flag being ignored: moved initialization from init() to PersistentPreRunE so flags are parsed before config loads
  • Add --rpc-url and --admin-url flags to override node URLs from config at runtime

Test plan

  • canopy --data-dir /custom/path <cmd> uses the specified directory
  • canopy --rpc-url http://localhost:9000 <cmd> overrides config RPC URL
  • canopy --admin-url http://localhost:9001 <cmd> overrides config admin URL
  • Default behavior unchanged when flags are omitted

ezeike added 3 commits May 11, 2026 16:09
InitializeDataDirectory was called in init() immediately after the
cobra flag was registered, before cobra had parsed args. DataDir was
always the default (~/.canopy) regardless of --data-dir value.

Move initialization into PersistentPreRunE which runs after flag
parsing but before any subcommand Run. Also adds toolchain directive
so go1.25.3 is used consistently (required for cockroachdb/swiss dep).
Allows targeting any node directly without needing a matching data
directory or config file swap. Flags override the URL loaded from
config.json after InitializeDataDirectory runs.
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