Skip to content

Commit e3c8bd6

Browse files
authored
feat(cli): support true for CS_DISABLE_FILE_DOWNLOADS (#5134)
After some feedback, we realized it is more intuitive to disable file downloads by setting the environment variable `CS_DISABLE_FILE_DOWNLOADS` to `true` than `1`. This commit adds support for both.
1 parent a0b3614 commit e3c8bd6

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/node/cli.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config
542542
args.password = process.env.PASSWORD
543543
}
544544

545-
if (process.env.CS_DISABLE_FILE_DOWNLOADS === "1") {
545+
if (process.env.CS_DISABLE_FILE_DOWNLOADS?.match(/^(1|true)$/)) {
546546
args["disable-file-downloads"] = true
547547
}
548548

test/unit/node/cli.test.ts

+12
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,18 @@ describe("parser", () => {
362362
})
363363
})
364364

365+
it("should use env var CS_DISABLE_FILE_DOWNLOADS set to true", async () => {
366+
process.env.CS_DISABLE_FILE_DOWNLOADS = "true"
367+
const args = parse([])
368+
expect(args).toEqual({})
369+
370+
const defaultArgs = await setDefaults(args)
371+
expect(defaultArgs).toEqual({
372+
...defaults,
373+
"disable-file-downloads": true,
374+
})
375+
})
376+
365377
it("should error if password passed in", () => {
366378
expect(() => parse(["--password", "supersecret123"])).toThrowError(
367379
"--password can only be set in the config file or passed in via $PASSWORD",

0 commit comments

Comments
 (0)