Compare commits

...

1 Commits

Author SHA1 Message Date
Jiayuan Zhang
b8ee851aab fix(cli): ensure cloud URLs are configured when not using local mode
After installing via `curl | bash` (default/cloud mode) or running
`multica setup` without a local server, the CLI config could retain
stale localhost URLs from a previous `multica config local` or
`--local` install. This caused `multica login` to connect to
localhost instead of multica.ai.

Fix: explicitly write cloud URLs (api.multica.ai / multica.ai) to
the config in both the install script's cloud mode and the setup
command's cloud fallback path.
2026-04-12 01:00:30 +08:00
2 changed files with 18 additions and 0 deletions

View File

@@ -241,6 +241,16 @@ configure_local() {
ok "CLI configured for localhost (backend :8080, frontend :3000)"
}
# ---------------------------------------------------------------------------
# Configure CLI for Multica Cloud
# ---------------------------------------------------------------------------
configure_cloud() {
info "Configuring CLI for Multica Cloud..."
multica config set server_url https://api.multica.ai 2>/dev/null || true
multica config set app_url https://multica.ai 2>/dev/null || true
ok "CLI configured for multica.ai"
}
# ---------------------------------------------------------------------------
# Main: Default mode (cloud — install CLI to connect to multica.ai)
# ---------------------------------------------------------------------------
@@ -252,6 +262,7 @@ run_default() {
detect_os
install_cli
configure_cloud
printf "\n"
printf "${BOLD}${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${RESET}\n"

View File

@@ -55,6 +55,13 @@ func runSetup(cmd *cobra.Command, args []string) error {
fmt.Fprintf(os.Stderr, " server_url: %s\n", cfg.ServerURL)
} else if !forceLocal {
fmt.Fprintln(os.Stderr, "No local server detected — using Multica Cloud (https://multica.ai).")
cfg, _ := cli.LoadCLIConfigForProfile(profile)
cfg.AppURL = "https://multica.ai"
cfg.ServerURL = "https://api.multica.ai"
if err := cli.SaveCLIConfigForProfile(cfg, profile); err != nil {
return fmt.Errorf("save config: %w", err)
}
}
// Authenticate.