Skip to content

Commit b6e1ea6

Browse files
committed
Update Terraform provider to use relative path
1 parent e3ff8ad commit b6e1ea6

File tree

16 files changed

+218
-189
lines changed

16 files changed

+218
-189
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
type Options struct {
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
defer q.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
return workspaceApp, nil

coderd/database/dump.sql

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

coderd/database/migrations/000011_workspace_apps.up.sql renamed 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 uuid NOT NULL REFERENCES workspace_agents (id) ON DELETE CASCADE,
55
name varchar(64) NOT NULL,
66
icon varchar(256) NOT NULL,
7-
-- A command to run when opened.
87
command varchar(65534),
9-
-- A URL or port to target.
10-
target varchar(65534),
8+
url varchar(65534),
9+
relative_path boolean NOT 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 about customizing 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 about customizing 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
if err != nil {
674675
return xerrors.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 := range dbApps {
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
return apps

0 commit comments

Comments
 (0)