Skip to content

Use API base URL for AI configuration endpoint#41

Merged
miguelsanchez-upsun merged 2 commits intomainfrom
cli-130-use-api-url-for-ai
Apr 10, 2026
Merged

Use API base URL for AI configuration endpoint#41
miguelsanchez-upsun merged 2 commits intomainfrom
cli-130-use-api-url-for-ai

Conversation

@pjcdawkins
Copy link
Copy Markdown
Contributor

Summary

  • Remove the separate ai_url config field (ai.upsun.com) and use the existing API base URL (api.upsun.com) for the /ai/generate-configuration endpoint
  • Remove the UPSUN_CLI_API_AI_URL environment variable override
  • Rename AIServiceURL to APIURL in init options

Generated with Claude Code

The /ai/generate-configuration endpoint is now served by the general
Upsun API (api.upsun.com) instead of a separate AI service host
(ai.upsun.com). Remove the separate ai_url config field and
AIServiceURL references, using the existing API base URL instead.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 9, 2026 06:39
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR simplifies AI configuration endpoint handling by removing the dedicated AI base URL configuration and routing /ai/generate-configuration through the existing API base URL.

Changes:

  • Removed the ai_url config field and the UPSUN_CLI_API_AI_URL environment variable override.
  • Renamed init options from AIServiceURL to APIURL and wired it to cnf.API.BaseURL.
  • Updated validation/error messaging to reflect the API URL requirement.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
internal/init/command.go Switches AI configuration endpoint base from AIServiceURL to APIURL when building the request URL.
commands/init.go Removes env override logic for AI URL and passes cnf.API.BaseURL into init options.
internal/config/upsun-cli.yaml Drops the api.ai_url default entry.
internal/config/schema.go Removes the AIServiceURL field from the config schema.
Comments suppressed due to low confidence (1)

internal/init/command.go:96

  • Building the AI endpoint URL by assigning u.Path = "/ai/generate-configuration" discards any existing path component in opts.APIURL (e.g., if a user sets the base URL to https://example.com/api for a proxy/dev environment). Consider preserving the existing base path by resolving a relative reference (or joining paths) instead of overwriting u.Path.
	u, err := url.Parse(opts.APIURL)
	if err != nil {
		return err
	}
	u.Path = "/ai/generate-configuration"
	urlStr := u.String()

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@miguelsanchez-upsun miguelsanchez-upsun merged commit c19bd1d into main Apr 10, 2026
4 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.

3 participants