Originally created by: thomijasir
Originally owned by: thomijasir
Task description
Improve two backend behaviors:
- When no public URL is configured, start the server with an inferred IP-based URL instead of rejecting a non-loopback bind. This should work like Vite's network URL output.
- Make
dopbase run non-interactive. If it cannot authenticate with a supplied token or an existing CLI session, it must exit with an error instead of opening the login prompt.
Public URL fallback
Explicit configuration remains the preferred source. When it is absent:
- Keep the current localhost URL for loopback-only binds.
- For a network bind, derive an HTTP URL from a usable local IP address and the configured port.
- Never present wildcard addresses such as
0.0.0.0 or :: as client URLs.
- Print a warning that the URL was inferred and may be wrong behind a proxy, NAT, or TLS terminator.
- Tell the user how to set the public URL with
--public-url, DOPBASE_PUBLIC_URL, or public_url in server.toml.
The warning should go to stderr so structured stdout remains valid.
Non-interactive dopbase run authentication
dopbase run is commonly used by scripts and process managers, so it must never request an email or password.
- Use a supplied token or a valid saved CLI session when available.
- If credentials are missing, exit with a non-zero status and an authentication-required message.
- If credentials are invalid, revoked, or expired, exit with a non-zero status and explain that the credentials were rejected.
- Include a practical next step, such as running
dopbase client login separately or setting DOPBASE_TOKEN.
- Keep machine-readable output free from interactive prompts and unrelated prose.
Acceptance criteria
- [ ] A non-loopback server can start without an explicitly configured public URL.
- [ ] The inferred URL contains a usable IP address and the configured port.
- [ ] Loopback binds continue to use the localhost fallback.
- [ ] Explicit public URL configuration still takes precedence.
- [ ] Startup prints a clear warning and shows all supported ways to configure the public URL.
- [ ] Public URL warnings are written to stderr.
- [ ]
dopbase run never opens an interactive login prompt.
- [ ] Missing and rejected credentials produce clear errors and non-zero exit codes.
- [ ] Tests cover loopback, network, wildcard, and explicit public URL resolution.
- [ ] Tests cover missing, invalid, revoked, and expired credentials for
dopbase run.
Ticket changed by: dopbase