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

Commit578eb11

Browse files
committed
Update Terraform provider to use relative path
1 parente3ff8ad commit578eb11

File tree

15 files changed

+216
-187
lines changed

15 files changed

+216
-187
lines changed

‎coderd/coderd.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,11 @@ import (
3434

3535
// Options are requires parameters for Coder to start.
3636
typeOptionsstruct {
37-
AccessURL*url.URL
38-
Logger slog.Logger
39-
Database database.Store
40-
Pubsub database.Pubsub
37+
AccessURL*url.URL
38+
WildcardURL*url.URL
39+
Logger slog.Logger
40+
Database database.Store
41+
Pubsub database.Pubsub
4142

4243
AgentConnectionUpdateFrequency time.Duration
4344
// APIRateLimit is the minutely throughput rate limit per user or ip.

‎coderd/database/databasefake/databasefake.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,13 +1533,14 @@ func (q *fakeQuerier) InsertWorkspaceApp(_ context.Context, arg database.InsertW
15331533
deferq.mutex.Unlock()
15341534

15351535
workspaceApp:= database.WorkspaceApp{
1536-
ID:arg.ID,
1537-
AgentID:arg.AgentID,
1538-
CreatedAt:arg.CreatedAt,
1539-
Name:arg.Name,
1540-
Icon:arg.Icon,
1541-
Command:arg.Command,
1542-
Target:arg.Target,
1536+
ID:arg.ID,
1537+
AgentID:arg.AgentID,
1538+
CreatedAt:arg.CreatedAt,
1539+
Name:arg.Name,
1540+
Icon:arg.Icon,
1541+
Command:arg.Command,
1542+
Url:arg.Url,
1543+
RelativePath:arg.RelativePath,
15431544
}
15441545
q.workspaceApps=append(q.workspaceApps,workspaceApp)
15451546
returnworkspaceApp,nil

‎coderd/database/dump.sql

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/migrations/000011_workspace_apps.up.sqlrenamed to‎coderd/database/migrations/000014_workspace_apps.up.sql

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ CREATE TABLE workspace_apps (
44
agent_id uuidNOT NULLREFERENCES workspace_agents (id)ON DELETE CASCADE,
55
namevarchar(64)NOT NULL,
66
iconvarchar(256)NOT NULL,
7-
-- A command to run when opened.
87
commandvarchar(65534),
9-
-- A URL or port to target.
10-
targetvarchar(65534),
8+
urlvarchar(65534),
9+
relative_pathbooleanNOT NULL DEFAULT false,
1110
PRIMARY KEY (id),
1211
UNIQUE(agent_id, name)
1312
);

‎coderd/database/models.go

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries.sql.go

Lines changed: 21 additions & 15 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries/workspaceapps.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@ INSERT INTO
1313
name,
1414
icon,
1515
command,
16-
target
16+
url,
17+
relative_path
1718
)
1819
VALUES
19-
($1, $2, $3, $4, $5, $6, $7) RETURNING*;
20+
($1, $2, $3, $4, $5, $6, $7, $8) RETURNING*;

‎coderd/provisionerdaemons.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,10 +665,11 @@ func insertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
665665
String:app.Command,
666666
Valid:app.Command!="",
667667
},
668-
Target: sql.NullString{
669-
String:app.Target,
670-
Valid:app.Target!="",
668+
Url: sql.NullString{
669+
String:app.Url,
670+
Valid:app.Url!="",
671671
},
672+
RelativePath:app.RelativePath,
672673
})
673674
iferr!=nil {
674675
returnxerrors.Errorf("insert app: %w",err)

‎coderd/workspaceagents.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -462,11 +462,11 @@ func convertApps(dbApps []database.WorkspaceApp) []codersdk.WorkspaceApp {
462462
apps:=make([]codersdk.WorkspaceApp,0)
463463
for_,dbApp:=rangedbApps {
464464
apps=append(apps, codersdk.WorkspaceApp{
465-
ID:dbApp.ID,
466-
Name:dbApp.Name,
467-
Command:dbApp.Command.String,
468-
Target:dbApp.Target.String,
469-
Icon:dbApp.Icon,
465+
ID:dbApp.ID,
466+
Name:dbApp.Name,
467+
Command:dbApp.Command.String,
468+
AccessURL:dbApp.Url.String,
469+
Icon:dbApp.Icon,
470470
})
471471
}
472472
returnapps

‎codersdk/workspaceapps.go

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,14 @@ package codersdk
33
import"github.com/google/uuid"
44

55
typeWorkspaceAppstruct {
6-
ID uuid.UUID`json:"id"`
7-
Namestring`json:"name"`
8-
Commandstring`json:"command,omitempty"`
9-
Targetstring`json:"target,omitempty"`
10-
Iconstring`json:"icon"`
6+
ID uuid.UUID`json:"id"`
7+
// Name is a unique identifier attached to an agent.
8+
Namestring`json:"name"`
9+
Commandstring`json:"command,omitempty"`
10+
// AccessURL is an address used to access the application.
11+
// If command is specified, this will be omitted.
12+
AccessURLstring`json:"access_url,omitempty"`
13+
// Icon is a relative path or external URL that specifies
14+
// an icon to be displayed in the dashboard.
15+
Iconstring`json:"icon"`
1116
}

‎provisioner/terraform/provision.go

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -523,11 +523,12 @@ func parseTerraformApply(ctx context.Context, terraform *tfexec.Terraform, state
523523
}
524524

525525
typeappAttributesstruct {
526-
AgentIDstring`mapstructure:"agent_id"`
527-
Namestring`mapstructure:"name"`
528-
Iconstring`mapstructure:"icon"`
529-
Targetstring`mapstructure:"target"`
530-
Commandstring`mapstructure:"command"`
526+
AgentIDstring`mapstructure:"agent_id"`
527+
Namestring`mapstructure:"name"`
528+
Iconstring`mapstructure:"icon"`
529+
URLstring`mapstructure:"url"`
530+
Commandstring`mapstructure:"command"`
531+
RelativePathbool`mapstructure:"relative_path"`
531532
}
532533
// Associate Apps with agents.
533534
for_,resource:=rangestate.Values.RootModule.Resources {
@@ -548,10 +549,11 @@ func parseTerraformApply(ctx context.Context, terraform *tfexec.Terraform, state
548549
continue
549550
}
550551
agent.Apps=append(agent.Apps,&proto.App{
551-
Name:attrs.Name,
552-
Command:attrs.Command,
553-
Target:attrs.Target,
554-
Icon:attrs.Icon,
552+
Name:attrs.Name,
553+
Command:attrs.Command,
554+
Url:attrs.URL,
555+
Icon:attrs.Icon,
556+
RelativePath:attrs.RelativePath,
555557
})
556558
}
557559
}

‎provisioner/terraform/provision_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ terraform {
3030
required_providers {
3131
coder = {
3232
source = "coder/coder"
33-
version = "0.4.0"
33+
version = "0.4.2"
3434
}
3535
}
3636
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp