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

Commitfc84e01

Browse files
docs: add URL scheme to example (#160)
Closes#159.This updates the documentation to include the access URL scheme in theexample, matching the coder.com docs.It also implicitly adds the scheme to the provided access URL if notpresent, only prepending `http://` if the access URL is localhost. Thisis the same behaviour as `coder login`.
1 parent48cd700 commitfc84e01

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

‎docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ terraform {
2727
}
2828
2929
provider "coderd" {
30-
url = "coder.example.com"
30+
url = "https://coder.example.com"
3131
token = "****"
3232
}
3333

‎examples/provider/provider.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ terraform {
77
}
88

99
provider"coderd" {
10-
url="coder.example.com"
10+
url="https://coder.example.com"
1111
token="****"
1212
}
1313

‎integration/integration.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func StartCoder(ctx context.Context, t *testing.T, name string, useLicense bool)
9595
t.Logf("not ready yet: %s",err.Error())
9696
}
9797
returnerr==nil
98-
},15*time.Second,time.Second,"coder failed to become ready in time")
98+
},20*time.Second,time.Second,"coder failed to become ready in time")
9999
_,err=client.CreateFirstUser(ctx, codersdk.CreateFirstUserRequest{
100100
Email:testEmail,
101101
Username:testUsername,

‎internal/provider/provider.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package provider
22

33
import (
44
"context"
5+
"fmt"
56
"net/url"
67
"os"
78
"strings"
@@ -101,7 +102,16 @@ func (p *CoderdProvider) Configure(ctx context.Context, req provider.ConfigureRe
101102
data.Token=types.StringValue(tokenEnv)
102103
}
103104

104-
url,err:=url.Parse(data.URL.ValueString())
105+
rawURL:=data.URL.ValueString()
106+
if!strings.HasPrefix(rawURL,"http://")&&!strings.HasPrefix(rawURL,"https://") {
107+
scheme:="https"
108+
ifstrings.HasPrefix(rawURL,"localhost") {
109+
scheme="http"
110+
}
111+
rawURL=fmt.Sprintf("%s://%s",scheme,rawURL)
112+
}
113+
114+
url,err:=url.Parse(rawURL)
105115
iferr!=nil {
106116
resp.Diagnostics.AddError("url","url is not a valid URL: "+err.Error())
107117
return

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp