Archived
1
0

Set proxy URI to domain proxy when possible (#6115)

This will make the ports panel use it instead of the default path-based
proxy.
This commit is contained in:
Asher
2023-03-30 12:01:49 -08:00
committed by GitHub
parent a44bd71043
commit c995988b70
2 changed files with 29 additions and 0 deletions

View File

@ -43,6 +43,7 @@ describe("parser", () => {
delete process.env.PASSWORD
delete process.env.CS_DISABLE_FILE_DOWNLOADS
delete process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE
delete process.env.VSCODE_PROXY_URI
console.log = jest.fn()
})
@ -457,6 +458,31 @@ describe("parser", () => {
port: 8082,
})
})
it("should not set proxy uri", async () => {
await setDefaults(parse([]))
expect(process.env.VSCODE_PROXY_URI).toBeUndefined()
})
it("should set proxy uri", async () => {
await setDefaults(parse(["--proxy-domain", "coder.org"]))
expect(process.env.VSCODE_PROXY_URI).toEqual("{{port}}.coder.org")
})
it("should set proxy uri to first domain", async () => {
await setDefaults(
parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "coder.com", "--proxy-domain", "coder.org"]),
)
expect(process.env.VSCODE_PROXY_URI).toEqual("{{port}}.coder.com")
})
it("should not override existing proxy uri", async () => {
process.env.VSCODE_PROXY_URI = "foo"
await setDefaults(
parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "coder.com", "--proxy-domain", "coder.org"]),
)
expect(process.env.VSCODE_PROXY_URI).toEqual("foo")
})
})
describe("cli", () => {