Skip to content

fix: use network-based default metadata server in tari publish#125

Merged
sdbondi merged 1 commit into
mainfrom
community-template-server
Apr 20, 2026
Merged

fix: use network-based default metadata server in tari publish#125
sdbondi merged 1 commit into
mainfrom
community-template-server

Conversation

@sdbondi
Copy link
Copy Markdown
Member

@sdbondi sdbondi commented Apr 20, 2026

Summary

  • tari publish previously hardcoded http://localhost:3000 as the metadata server fallback, ignoring the active network
  • Now resolves the default from the wallet network (matching tari metadata publish) — localnet → localhost, esmeraldahttps://ootle-templates-esme.tari.com/
  • Errors out if no default is known for the network, instead of silently submitting to the wrong server
  • Moved get_default_metadata_server_url from metadata/publish.rs into cli/util.rs so both commands share it

Test plan

  • tari publish --publish-metadata on esmeralda posts to the esmeralda community server (not localhost)
  • tari publish --publish-metadata on localnet still posts to http://localhost:3000
  • --metadata-server-url flag and tari.config.toml value still override the default
  • Unknown network surfaces a clear error asking for --metadata-server-url

🤖 Generated with Claude Code

`tari publish` previously fell back to `http://localhost:3000` when no
metadata server URL was provided, ignoring the active network. It now
resolves the default from the wallet network (same as
`tari metadata publish`), and errors out if no default is known.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@sdbondi sdbondi force-pushed the community-template-server branch from ae6d892 to d1f8209 Compare April 20, 2026 13:27
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the default metadata server URL resolution by moving the logic into a shared utility function and applying it to the template publishing command. This replaces a hardcoded URL with a network-aware lookup and adds error handling for cases where no default is defined. Feedback suggests that the default URL should be parsed lazily to improve efficiency when the URL is already provided through other configuration sources.

Comment on lines +213 to +214
let resolved_default = get_default_metadata_server_url(&info.network)
.map(|s| s.parse::<url::Url>().expect("parse default metadata server url"));
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The default metadata server URL is parsed even if it's not needed (i.e., when a URL is provided via CLI arguments, project config, or global config). While Url::parse is relatively inexpensive for these short, hardcoded strings, it would be more efficient to perform this resolution lazily only when all other configuration sources are None.

@sdbondi sdbondi merged commit d2a0ff2 into main Apr 20, 2026
4 of 6 checks passed
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