Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ethanndickson merged 2 commits intomainfromethan/url-scheme-docs
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletiondocs/index.md
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -27,7 +27,7 @@ terraform {
}

provider "coderd" {
url = "coder.example.com"
url = "https://coder.example.com"
token = "****"
}

Expand Down
2 changes: 1 addition & 1 deletionexamples/provider/provider.tf
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@ terraform {
}

provider "coderd" {
url = "coder.example.com"
url = "https://coder.example.com"
token = "****"
}

Expand Down
2 changes: 1 addition & 1 deletionintegration/integration.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -95,7 +95,7 @@ func StartCoder(ctx context.Context, t *testing.T, name string, useLicense bool)
t.Logf("not ready yet: %s", err.Error())
}
return err == nil
},15*time.Second, time.Second, "coder failed to become ready in time")
},20*time.Second, time.Second, "coder failed to become ready in time")
_, err = client.CreateFirstUser(ctx, codersdk.CreateFirstUserRequest{
Email: testEmail,
Username: testUsername,
Expand Down
12 changes: 11 additions & 1 deletioninternal/provider/provider.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@ package provider

import (
"context"
"fmt"
"net/url"
"os"
"strings"
Expand DownExpand Up@@ -101,7 +102,16 @@ func (p *CoderdProvider) Configure(ctx context.Context, req provider.ConfigureRe
data.Token = types.StringValue(tokenEnv)
}

url, err := url.Parse(data.URL.ValueString())
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)
Comment on lines +105 to +114
Copy link
MemberAuthor

Choose a reason for hiding this comment

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

if err != nil {
resp.Diagnostics.AddError("url", "url is not a valid URL: "+err.Error())
return
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp