Skip to content

Commit 1e4e72a

Browse files
authored
Merge pull request #2184 from nhooyr/link-flag-1547
cloud: Rename --coder-bind to --link
2 parents 2d1de74 + fcfb033 commit 1e4e72a

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/node/cli.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export interface Args extends VsArgs {
4848
readonly "reuse-window"?: boolean
4949
readonly "new-window"?: boolean
5050

51-
readonly "coder-bind"?: OptionalString
51+
readonly link?: OptionalString
5252
}
5353

5454
interface Option<T> {
@@ -164,7 +164,7 @@ const options: Options<Required<Args>> = {
164164
log: { type: LogLevel },
165165
verbose: { type: "boolean", short: "vvv", description: "Enable verbose logging." },
166166

167-
"coder-bind": {
167+
link: {
168168
type: OptionalString,
169169
description: `
170170
Securely bind code-server via Coder Cloud with the passed name. You'll get a URL like

src/node/coder-cloud.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { spawn } from "child_process"
33
import path from "path"
44
import split2 from "split2"
55

6+
// https://github.com/cdr/coder-cloud
67
const coderCloudAgent = path.resolve(__dirname, "../../lib/coder-cloud-agent")
78

89
function runAgent(...args: string[]): Promise<void> {
@@ -33,7 +34,7 @@ function runAgent(...args: string[]): Promise<void> {
3334
}
3435

3536
export function coderCloudBind(csAddr: string, serverName = ""): Promise<void> {
36-
logger.info("Remember --coder-bind is a beta feature and requires being accepted for testing")
37+
logger.info("Remember --link is a beta feature and requires being accepted for testing")
3738
logger.info("See https://github.com/cdr/code-server/discussions/2137")
3839
// addr needs to be in host:port format.
3940
// So we trim the protocol.

src/node/entry.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const version = pkg.version || "development"
3636
const commit = pkg.commit || "development"
3737

3838
const main = async (args: Args, configArgs: Args): Promise<void> => {
39-
if (args["coder-bind"]) {
39+
if (args.link) {
4040
// If we're being exposed to the cloud, we listen on a random address and disable auth.
4141
args = {
4242
...args,
@@ -46,7 +46,7 @@ const main = async (args: Args, configArgs: Args): Promise<void> => {
4646
socket: undefined,
4747
cert: undefined,
4848
}
49-
logger.info("coder-bind: disabling auth and listening on random localhost port")
49+
logger.info("link: disabling auth and listening on random localhost port for cloud agent")
5050
}
5151

5252
if (!args.auth) {
@@ -143,9 +143,9 @@ const main = async (args: Args, configArgs: Args): Promise<void> => {
143143
logger.info(`Opened ${openAddress}`)
144144
}
145145

146-
if (args["coder-bind"]) {
146+
if (args.link) {
147147
try {
148-
await coderCloudBind(serverAddress!, args["coder-bind"].value)
148+
await coderCloudBind(serverAddress!, args.link.value)
149149
} catch (err) {
150150
logger.error(err.message)
151151
ipcMain().exit(1)

0 commit comments

Comments
 (0)