Use cli.toml for default start listen address#4900
Open
0monish wants to merge 1 commit intoclockworklabs:masterfrom
Open
Use cli.toml for default start listen address#49000monish wants to merge 1 commit intoclockworklabs:masterfrom
0monish wants to merge 1 commit intoclockworklabs:masterfrom
Conversation
bfops
reviewed
Apr 27, 2026
| if s == "-l" | ||
| || (s.starts_with("-l") | ||
| && !s.starts_with("--") | ||
| && s.as_bytes().get(2).is_some_and(|b| !b.is_ascii_alphabetic())) |
Collaborator
There was a problem hiding this comment.
can you explain this block? at first glance it seems like if s.starts_with("-l") passes, these other checks would as well.
bfops
reviewed
Apr 27, 2026
| /// - `--listen-addr=<value>` | ||
| /// - `-l <value>` (two separate tokens) | ||
| /// - `-l<value>` (short flag with attached value, e.g. `-l0.0.0.0:4000`) | ||
| fn has_listen_addr_arg(args: impl Iterator<Item = impl AsRef<std::ffi::OsStr>>) -> bool { |
Collaborator
There was a problem hiding this comment.
this function can be removed entirely. if --listen-addr is passed multiple times to spacetimedb-standalone, the last one will be respected.
I would add a comment to this effect when passing --listen-addr.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
This change addresses reviewer feedback on #4576.
As requested by
@cloutiertyler, here are the changes:spacetime startfrom projectspacetime.jsonto CLIcli.tomlConfigintospacetime startinstead of introducing a separate project-config lookup in that subcommand--listen-addr/-lstill wins over config, and config still wins over the built-in standalone defaultspacetime startCLI reference instead of the standalone runtime-config pageBehavior precedence is now:
spacetime start --listen-addr 127.0.0.1:5000listen_addrfromcli.toml0.0.0.0:3000Example:
With that config in place,
spacetime startwill bind to0.0.0.0:4000unless the user passes--listen-addrexplicitly.Implementation details:
listen_addrfield to the existing CLI config parser and persistence pathspacetime startto use the loaded CLI config rather than reading project config directly--listen-addrand-ldetection so config is only injected when the user did not provide an explicit listen addressspacetime startRelated:
API and ABI breaking changes
None.
This change does not modify any public API or ABI. It only changes where the CLI reads an optional default value for an existing
spacetime startflag.Expected complexity level and risk
Complexity: 2/5
This is a small, localized CLI behavior change.
The main interaction point is precedence between forwarded CLI args and persisted CLI config. Risk is low because this change:
listen_addris absent--listen-addrand-lprecedencecli.tomlloading path instead of adding another config systemTesting
Completed:
cargo fmt --all --checkcargo check -p spacetimedb-clicargo clippy -p spacetimedb-cli --all-targetscargo test -p spacetimedb-cli config::tests --libcargo test -p spacetimedb-cli subcommands::start::tests --libReviewer checks:
spacetime startwithoutlisten_addrincli.tomland confirm it still binds to0.0.0.0:3000listen_addr = "0.0.0.0:4000"tocli.toml, runspacetime start, and confirm it binds to0.0.0.0:4000spacetime start --listen-addr 127.0.0.1:5000with config present and confirm the CLI flag still wins