mirror of https://github.com/coder/code-server.git
woo!
This commit is contained in:
parent
e588f8b0b0
commit
45319ec648
|
@ -310,12 +310,10 @@ export const parse = (
|
||||||
throw error(`Unknown option ${arg}`)
|
throw error(`Unknown option ${arg}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO@jsjoeio add test for this if block
|
|
||||||
if (key === "password" && !opts?.configFile) {
|
if (key === "password" && !opts?.configFile) {
|
||||||
throw new Error("--password can only be set in the config file or passed in via $PASSWORD")
|
throw new Error("--password can only be set in the config file or passed in via $PASSWORD")
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO@jsjoeio add test for this if block
|
|
||||||
if (key === "hashed-password" && !opts?.configFile) {
|
if (key === "hashed-password" && !opts?.configFile) {
|
||||||
throw new Error("--hashed-password can only be set in the config file or passed in via $HASHED_PASSWORD")
|
throw new Error("--hashed-password can only be set in the config file or passed in via $HASHED_PASSWORD")
|
||||||
}
|
}
|
||||||
|
|
|
@ -333,6 +333,18 @@ describe("parser", () => {
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should error if password passed in", () => {
|
||||||
|
expect(() => parse(["--password", "supersecret123"])).toThrowError(
|
||||||
|
"--password can only be set in the config file or passed in via $PASSWORD",
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
it("should error if hashed-password passed in", () => {
|
||||||
|
expect(() => parse(["--hashed-password", "fdas423fs8a"])).toThrowError(
|
||||||
|
"--hashed-password can only be set in the config file or passed in via $HASHED_PASSWORD",
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
it("should filter proxy domains", async () => {
|
it("should filter proxy domains", async () => {
|
||||||
const args = parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "coder.com", "--proxy-domain", "coder.org"])
|
const args = parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "coder.com", "--proxy-domain", "coder.org"])
|
||||||
expect(args).toEqual({
|
expect(args).toEqual({
|
||||||
|
|
Loading…
Reference in New Issue