Skip to content

Commit 2a66395

Browse files
authored
feat: use app wildcards for apps if configured (#4263)
* feat: use app wildcards for apps if configured * feat: relative_path -> subdomain - rename relative_path -> subdomain when referring to apps - migrate workspace_apps.relative_path to workspace_apps.subdomain - upgrade coder/coder terraform module to 0.5.0
1 parent 4f3958c commit 2a66395

File tree

57 files changed

+577
-505
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+577
-505
lines changed

coderd/database/databasefake/databasefake.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2069,7 +2069,7 @@ func (q *fakeQuerier) InsertWorkspaceApp(_ context.Context, arg database.InsertW
20692069
Icon: arg.Icon,
20702070
Command: arg.Command,
20712071
Url: arg.Url,
2072-
RelativePath: arg.RelativePath,
2072+
Subdomain: arg.Subdomain,
20732073
HealthcheckUrl: arg.HealthcheckUrl,
20742074
HealthcheckInterval: arg.HealthcheckInterval,
20752075
HealthcheckThreshold: arg.HealthcheckThreshold,

coderd/database/dump.sql

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Add column relative_path of type bool to workspace_apps
2+
ALTER TABLE "workspace_apps" ADD COLUMN "relative_path" bool NOT NULL DEFAULT false;
3+
4+
-- Set column relative_path to the opposite of subdomain
5+
UPDATE "workspace_apps" SET "relative_path" = NOT "subdomain";
6+
7+
-- Drop column subdomain
8+
ALTER TABLE "workspace_apps" DROP COLUMN "subdomain";
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
-- Add column subdomain of type bool to workspace_apps
2+
ALTER TABLE "workspace_apps" ADD COLUMN "subdomain" bool NOT NULL DEFAULT false;
3+
4+
-- Set column subdomain to the opposite of relative_path
5+
UPDATE "workspace_apps" SET "subdomain" = NOT "relative_path";
6+
7+
-- Drop column relative_path
8+
ALTER TABLE "workspace_apps" DROP COLUMN "relative_path";

coderd/database/models.go

Lines changed: 1 addition & 1 deletion
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: 13 additions & 13 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ INSERT INTO
2020
icon,
2121
command,
2222
url,
23-
relative_path,
23+
subdomain,
2424
healthcheck_url,
2525
healthcheck_interval,
2626
healthcheck_threshold,

coderd/provisionerdaemons.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ func insertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
828828
String: app.Url,
829829
Valid: app.Url != "",
830830
},
831-
RelativePath: app.RelativePath,
831+
Subdomain: app.Subdomain,
832832
HealthcheckUrl: app.Healthcheck.Url,
833833
HealthcheckInterval: app.Healthcheck.Interval,
834834
HealthcheckThreshold: app.Healthcheck.Threshold,

coderd/telemetry/telemetry.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -528,11 +528,11 @@ func ConvertWorkspaceAgent(agent database.WorkspaceAgent) WorkspaceAgent {
528528
// ConvertWorkspaceApp anonymizes a workspace app.
529529
func ConvertWorkspaceApp(app database.WorkspaceApp) WorkspaceApp {
530530
return WorkspaceApp{
531-
ID: app.ID,
532-
CreatedAt: app.CreatedAt,
533-
AgentID: app.AgentID,
534-
Icon: app.Icon,
535-
RelativePath: app.RelativePath,
531+
ID: app.ID,
532+
CreatedAt: app.CreatedAt,
533+
AgentID: app.AgentID,
534+
Icon: app.Icon,
535+
Subdomain: app.Subdomain,
536536
}
537537
}
538538

@@ -692,11 +692,11 @@ type WorkspaceAgent struct {
692692
}
693693

694694
type WorkspaceApp struct {
695-
ID uuid.UUID `json:"id"`
696-
CreatedAt time.Time `json:"created_at"`
697-
AgentID uuid.UUID `json:"agent_id"`
698-
Icon string `json:"icon"`
699-
RelativePath bool `json:"relative_path"`
695+
ID uuid.UUID `json:"id"`
696+
CreatedAt time.Time `json:"created_at"`
697+
AgentID uuid.UUID `json:"agent_id"`
698+
Icon string `json:"icon"`
699+
Subdomain bool `json:"subdomain"`
700700
}
701701

702702
type WorkspaceBuild struct {

coderd/workspaceagents.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -494,10 +494,11 @@ func convertApps(dbApps []database.WorkspaceApp) []codersdk.WorkspaceApp {
494494
apps := make([]codersdk.WorkspaceApp, 0)
495495
for _, dbApp := range dbApps {
496496
apps = append(apps, codersdk.WorkspaceApp{
497-
ID: dbApp.ID,
498-
Name: dbApp.Name,
499-
Command: dbApp.Command.String,
500-
Icon: dbApp.Icon,
497+
ID: dbApp.ID,
498+
Name: dbApp.Name,
499+
Command: dbApp.Command.String,
500+
Icon: dbApp.Icon,
501+
Subdomain: dbApp.Subdomain,
501502
Healthcheck: codersdk.Healthcheck{
502503
URL: dbApp.HealthcheckUrl,
503504
Interval: dbApp.HealthcheckInterval,

0 commit comments

Comments
 (0)