Skip to content

Commit 60f54c7

Browse files
authored
Merge branch 'main' into gemini-MCP-config
2 parents 3af9c97 + 4688e4c commit 60f54c7

3 files changed

Lines changed: 29 additions & 5 deletions

File tree

registry/coder/modules/filebrowser/README.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ A file browser for your workspace.
1414
module "filebrowser" {
1515
count = data.coder_workspace.me.start_count
1616
source = "registry.coder.com/coder/filebrowser/coder"
17-
version = "1.1.4"
17+
version = "1.1.5"
1818
agent_id = coder_agent.main.id
1919
}
2020
```
@@ -29,7 +29,7 @@ module "filebrowser" {
2929
module "filebrowser" {
3030
count = data.coder_workspace.me.start_count
3131
source = "registry.coder.com/coder/filebrowser/coder"
32-
version = "1.1.4"
32+
version = "1.1.5"
3333
agent_id = coder_agent.main.id
3434
folder = "/home/coder/project"
3535
}
@@ -41,19 +41,21 @@ module "filebrowser" {
4141
module "filebrowser" {
4242
count = data.coder_workspace.me.start_count
4343
source = "registry.coder.com/coder/filebrowser/coder"
44-
version = "1.1.4"
44+
version = "1.1.5"
4545
agent_id = coder_agent.main.id
4646
database_path = ".config/filebrowser.db"
4747
}
4848
```
4949

5050
### Serve from the same domain (no subdomain)
5151

52+
When `subdomain = false`, you must also set `agent_name` to the name of your `coder_agent` resource. Coder serves path-based apps at `/@<owner>/<workspace>.<agent>/apps/<slug>/`, so the agent name is required to build a base URL that matches the URL the user is actually browsing. If `agent_name` is omitted in this mode, `terraform apply` will fail with an explanatory error.
53+
5254
```tf
5355
module "filebrowser" {
5456
count = data.coder_workspace.me.start_count
5557
source = "registry.coder.com/coder/filebrowser/coder"
56-
version = "1.1.4"
58+
version = "1.1.5"
5759
agent_id = coder_agent.main.id
5860
agent_name = "main"
5961
subdomain = false

registry/coder/modules/filebrowser/main.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,19 @@ describe("filebrowser", async () => {
102102

103103
testBaseLine(output);
104104
}, 15000);
105+
106+
it("fails when subdomain=false and agent_name is not provided", async () => {
107+
let caught: Error | undefined;
108+
try {
109+
await runTerraformApply(import.meta.dir, {
110+
agent_id: "foo",
111+
subdomain: false,
112+
});
113+
} catch (e) {
114+
caught = e as Error;
115+
}
116+
expect(caught).toBeDefined();
117+
expect(caught!.message).toContain("agent_name");
118+
expect(caught!.message).toContain("subdomain");
119+
}, 15000);
105120
});

registry/coder/modules/filebrowser/main.tf

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ data "coder_workspace_owner" "me" {}
2020

2121
variable "agent_name" {
2222
type = string
23-
description = "The name of the coder_agent resource. (Only required if subdomain is false and the template uses multiple agents.)"
23+
description = "The name of the coder_agent resource. Required when `subdomain` is `false` so the path-based base URL matches the URL Coder serves."
2424
default = null
2525
}
2626

@@ -102,6 +102,13 @@ resource "coder_script" "filebrowser" {
102102
SERVER_BASE_PATH : local.server_base_path
103103
})
104104
run_on_start = true
105+
106+
lifecycle {
107+
precondition {
108+
condition = var.subdomain || var.agent_name != null
109+
error_message = "`agent_name` is required when `subdomain` is `false`. Coder always builds path-based app URLs as `/@<owner>/<workspace>.<agent>/apps/<slug>/`, so the filebrowser base URL must include the agent name to match. Set `agent_name = \"<your coder_agent name>\"` (e.g. `\"main\"`)."
110+
}
111+
}
105112
}
106113

107114
resource "coder_app" "filebrowser" {

0 commit comments

Comments
 (0)