Skip to content

docs: add URL scheme to example #160

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 6, 2025
Merged

Conversation

ethanndickson
Copy link
Member

@ethanndickson ethanndickson commented Jan 6, 2025

Closes #159.

This updates the documentation to include the access URL scheme in the example, matching the coder.com docs.

It also implicitly adds the scheme to the provided access URL if not present, only prepending http:// if the access URL is localhost. This is the same behaviour as coder login.

Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Comment on lines +105 to +114
rawURL := data.URL.ValueString()
if !strings.HasPrefix(rawURL, "http://") && !strings.HasPrefix(rawURL, "https://") {
scheme := "https"
if strings.HasPrefix(rawURL, "localhost") {
scheme = "http"
}
rawURL = fmt.Sprintf("%s://%s", scheme, rawURL)
}

url, err := url.Parse(rawURL)
Copy link
Member Author

Choose a reason for hiding this comment

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

@ethanndickson ethanndickson requested a review from johnstcn January 6, 2025 04:14
@ethanndickson ethanndickson marked this pull request as ready for review January 6, 2025 04:14
@ethanndickson ethanndickson merged commit fc84e01 into main Jan 6, 2025
14 checks passed
@ethanndickson ethanndickson deleted the ethan/url-scheme-docs branch January 6, 2025 10:07
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.

Provider Resource - Improve Error Outputs
2 participants