fix(filebrowser): only require agent_name when not on subdomain (#299)
This commit is contained in:
committed by
GitHub
parent
ad1189afff
commit
162808760d
@@ -16,7 +16,6 @@ module "filebrowser" {
|
|||||||
source = "registry.coder.com/modules/filebrowser/coder"
|
source = "registry.coder.com/modules/filebrowser/coder"
|
||||||
version = "1.0.18"
|
version = "1.0.18"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "main"
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -31,7 +30,6 @@ module "filebrowser" {
|
|||||||
source = "registry.coder.com/modules/filebrowser/coder"
|
source = "registry.coder.com/modules/filebrowser/coder"
|
||||||
version = "1.0.18"
|
version = "1.0.18"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "main"
|
|
||||||
folder = "/home/coder/project"
|
folder = "/home/coder/project"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
@@ -43,7 +41,6 @@ module "filebrowser" {
|
|||||||
source = "registry.coder.com/modules/filebrowser/coder"
|
source = "registry.coder.com/modules/filebrowser/coder"
|
||||||
version = "1.0.18"
|
version = "1.0.18"
|
||||||
agent_id = coder_agent.example.id
|
agent_id = coder_agent.example.id
|
||||||
agent_name = "main"
|
|
||||||
database_path = ".config/filebrowser.db"
|
database_path = ".config/filebrowser.db"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|||||||
@@ -11,13 +11,11 @@ describe("filebrowser", async () => {
|
|||||||
|
|
||||||
testRequiredVariables(import.meta.dir, {
|
testRequiredVariables(import.meta.dir, {
|
||||||
agent_id: "foo",
|
agent_id: "foo",
|
||||||
agent_name: "main",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fails with wrong database_path", async () => {
|
it("fails with wrong database_path", async () => {
|
||||||
const state = await runTerraformApply(import.meta.dir, {
|
const state = await runTerraformApply(import.meta.dir, {
|
||||||
agent_id: "foo",
|
agent_id: "foo",
|
||||||
agent_name: "main",
|
|
||||||
database_path: "nofb",
|
database_path: "nofb",
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
if (!e.message.startsWith("\nError: Invalid value for variable")) {
|
if (!e.message.startsWith("\nError: Invalid value for variable")) {
|
||||||
@@ -29,7 +27,6 @@ describe("filebrowser", async () => {
|
|||||||
it("runs with default", async () => {
|
it("runs with default", async () => {
|
||||||
const state = await runTerraformApply(import.meta.dir, {
|
const state = await runTerraformApply(import.meta.dir, {
|
||||||
agent_id: "foo",
|
agent_id: "foo",
|
||||||
agent_name: "main",
|
|
||||||
});
|
});
|
||||||
const output = await executeScriptInContainer(state, "alpine");
|
const output = await executeScriptInContainer(state, "alpine");
|
||||||
expect(output.exitCode).toBe(0);
|
expect(output.exitCode).toBe(0);
|
||||||
@@ -51,7 +48,6 @@ describe("filebrowser", async () => {
|
|||||||
it("runs with database_path var", async () => {
|
it("runs with database_path var", async () => {
|
||||||
const state = await runTerraformApply(import.meta.dir, {
|
const state = await runTerraformApply(import.meta.dir, {
|
||||||
agent_id: "foo",
|
agent_id: "foo",
|
||||||
agent_name: "main",
|
|
||||||
database_path: ".config/filebrowser.db",
|
database_path: ".config/filebrowser.db",
|
||||||
});
|
});
|
||||||
const output = await executeScriptInContainer(state, "alpine");
|
const output = await executeScriptInContainer(state, "alpine");
|
||||||
@@ -74,7 +70,6 @@ describe("filebrowser", async () => {
|
|||||||
it("runs with folder var", async () => {
|
it("runs with folder var", async () => {
|
||||||
const state = await runTerraformApply(import.meta.dir, {
|
const state = await runTerraformApply(import.meta.dir, {
|
||||||
agent_id: "foo",
|
agent_id: "foo",
|
||||||
agent_name: "main",
|
|
||||||
folder: "/home/coder/project",
|
folder: "/home/coder/project",
|
||||||
});
|
});
|
||||||
const output = await executeScriptInContainer(state, "alpine");
|
const output = await executeScriptInContainer(state, "alpine");
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ data "coder_workspace_owner" "me" {}
|
|||||||
variable "agent_name" {
|
variable "agent_name" {
|
||||||
type = string
|
type = string
|
||||||
description = "The name of the main deployment. (Used to build the subpath for coder_app.)"
|
description = "The name of the main deployment. (Used to build the subpath for coder_app.)"
|
||||||
|
default = ""
|
||||||
|
validation {
|
||||||
|
# If subdomain is false, then agent_name must be set.
|
||||||
|
condition = var.subdomain || var.agent_name != ""
|
||||||
|
error_message = "The agent_name must be set."
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "database_path" {
|
variable "database_path" {
|
||||||
|
|||||||
Reference in New Issue
Block a user