Skip to content

Commit 12da14d

Browse files
committed
fix: use CODE_SERVER_ reconnection grace time env var
1 parent 5a45855 commit 12da14d

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

docs/FAQ.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- [How do I debug issues with code-server?](#how-do-i-debug-issues-with-code-server)
2323
- [What is the healthz endpoint?](#what-is-the-healthz-endpoint)
2424
- [What is the heartbeat file?](#what-is-the-heartbeat-file)
25+
- [How do I change the reconnection grace time?](#how-do-i-change-the-reconnection-grace-time)
2526
- [How do I change the password?](#how-do-i-change-the-password)
2627
- [Can I store my password hashed?](#can-i-store-my-password-hashed)
2728
- [Is multi-tenancy possible?](#is-multi-tenancy-possible)
@@ -326,6 +327,16 @@ If you want to shutdown code-server if there hasn't been an active connection
326327
after a predetermined amount of time, you can use the --idle-timeout-seconds flag
327328
or set an `CODE_SERVER_IDLE_TIMEOUT_SECONDS` environment variable.
328329

330+
## How do I change the reconnection grace time?
331+
332+
Pass `--reconnection-grace-time <seconds>` to `code-server`, set
333+
`CODE_SERVER_RECONNECTION_GRACE_TIME=<seconds>`, or add
334+
`reconnection-grace-time: <seconds>` to
335+
`~/.config/code-server/config.yaml`.
336+
337+
The default is `10800` (3 hours). If a client stays disconnected longer than
338+
this, it must reload the window.
339+
329340
## How do I change the password?
330341

331342
Edit the `password` field in the code-server config file at

src/node/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -639,8 +639,8 @@ export async function setDefaults(cliArgs: UserProvidedArgs, configArgs?: Config
639639
args["github-auth"] = process.env.GITHUB_TOKEN
640640
}
641641

642-
if (process.env.CS_RECONNECTION_GRACE_TIME) {
643-
args["reconnection-grace-time"] = process.env.CS_RECONNECTION_GRACE_TIME
642+
if (process.env.CODE_SERVER_RECONNECTION_GRACE_TIME) {
643+
args["reconnection-grace-time"] = process.env.CODE_SERVER_RECONNECTION_GRACE_TIME
644644
}
645645

646646
if (process.env.CODE_SERVER_IDLE_TIMEOUT_SECONDS) {

test/unit/node/cli.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ describe("parser", () => {
4848
delete process.env.PASSWORD
4949
delete process.env.CS_DISABLE_FILE_DOWNLOADS
5050
delete process.env.CS_DISABLE_GETTING_STARTED_OVERRIDE
51-
delete process.env.CS_RECONNECTION_GRACE_TIME
51+
delete process.env.CODE_SERVER_RECONNECTION_GRACE_TIME
5252
delete process.env.VSCODE_PROXY_URI
5353
delete process.env.CS_DISABLE_PROXY
5454
console.log = jest.fn()
@@ -461,8 +461,8 @@ describe("parser", () => {
461461
})
462462
})
463463

464-
it("should use env var CS_RECONNECTION_GRACE_TIME", async () => {
465-
process.env.CS_RECONNECTION_GRACE_TIME = "86400"
464+
it("should use env var CODE_SERVER_RECONNECTION_GRACE_TIME for reconnection grace time", async () => {
465+
process.env.CODE_SERVER_RECONNECTION_GRACE_TIME = "86400"
466466
const args = parse([])
467467
expect(args).toEqual({})
468468

@@ -471,7 +471,7 @@ describe("parser", () => {
471471
...defaults,
472472
"reconnection-grace-time": "86400",
473473
})
474-
delete process.env.CS_RECONNECTION_GRACE_TIME
474+
delete process.env.CODE_SERVER_RECONNECTION_GRACE_TIME
475475
})
476476

477477
it("should error if password passed in", () => {

0 commit comments

Comments
 (0)