Skip to content

cloud: Rename --coder-bind to --link #2184

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export interface Args extends VsArgs {
readonly "reuse-window"?: boolean
readonly "new-window"?: boolean

readonly "coder-bind"?: OptionalString
readonly link?: OptionalString
}

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

"coder-bind": {
link: {
type: OptionalString,
description: `
Securely bind code-server via Coder Cloud with the passed name. You'll get a URL like
Expand Down
3 changes: 2 additions & 1 deletion src/node/coder-cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { spawn } from "child_process"
import path from "path"
import split2 from "split2"

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

function runAgent(...args: string[]): Promise<void> {
Expand Down Expand Up @@ -33,7 +34,7 @@ function runAgent(...args: string[]): Promise<void> {
}

export function coderCloudBind(csAddr: string, serverName = ""): Promise<void> {
logger.info("Remember --coder-bind is a beta feature and requires being accepted for testing")
logger.info("Remember --link is a beta feature and requires being accepted for testing")
logger.info("See https://github.com/cdr/code-server/discussions/2137")
// addr needs to be in host:port format.
// So we trim the protocol.
Expand Down
8 changes: 4 additions & 4 deletions src/node/entry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const version = pkg.version || "development"
const commit = pkg.commit || "development"

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

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

if (args["coder-bind"]) {
if (args.link) {
try {
await coderCloudBind(serverAddress!, args["coder-bind"].value)
await coderCloudBind(serverAddress!, args.link.value)
} catch (err) {
logger.error(err.message)
ipcMain().exit(1)
Expand Down