feat: github-auth flag (#4926)
* feat: github-auth flag This will allow injecting credentials into code-server if you already have them. * Update Code Contains the GitHub auth changes. * Add e2e test for GitHub token
This commit is contained in:
@ -313,6 +313,19 @@ describe("parser", () => {
|
||||
})
|
||||
})
|
||||
|
||||
it("should use env var github token", async () => {
|
||||
process.env.GITHUB_TOKEN = "ga-foo"
|
||||
const args = parse([])
|
||||
expect(args).toEqual({})
|
||||
|
||||
const defaultArgs = await setDefaults(args)
|
||||
expect(defaultArgs).toEqual({
|
||||
...defaults,
|
||||
"github-auth": "ga-foo",
|
||||
})
|
||||
expect(process.env.GITHUB_TOKEN).toBe(undefined)
|
||||
})
|
||||
|
||||
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",
|
||||
@ -325,6 +338,12 @@ describe("parser", () => {
|
||||
)
|
||||
})
|
||||
|
||||
it("should error if github-auth passed in", () => {
|
||||
expect(() => parse(["--github-auth", "fdas423fs8a"])).toThrowError(
|
||||
"--github-auth can only be set in the config file or passed in via $GITHUB_TOKEN",
|
||||
)
|
||||
})
|
||||
|
||||
it("should filter proxy domains", async () => {
|
||||
const args = parse(["--proxy-domain", "*.coder.com", "--proxy-domain", "coder.com", "--proxy-domain", "coder.org"])
|
||||
expect(args).toEqual({
|
||||
@ -374,6 +393,11 @@ describe("parser", () => {
|
||||
it("should ignore optional strings set to false", async () => {
|
||||
expect(parse(["--cert=false"])).toEqual({})
|
||||
})
|
||||
it("should use last flag", async () => {
|
||||
expect(parse(["--port", "8081", "--port", "8082"])).toEqual({
|
||||
port: 8082,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("cli", () => {
|
||||
|
Reference in New Issue
Block a user