@@ -12,7 +12,7 @@ import { StaticHttpProvider } from "./app/static"
1212import { UpdateHttpProvider } from "./app/update"
1313import { VscodeHttpProvider } from "./app/vscode"
1414import { Args , bindAddrFromAllSources , optionDescriptions , parse , readConfigFile , setDefaults } from "./cli"
15- import { coderCloudLink , coderCloudProxy } from "./coder-cloud"
15+ import { coderCloudBind , coderCloudProxy } from "./coder-cloud"
1616import { AuthType , HttpServer , HttpServerOptions } from "./http"
1717import { loadPlugins } from "./plugin"
1818import { generateCertificate , hash , humanPath , open } from "./util"
@@ -36,13 +36,15 @@ const version = pkg.version || "development"
3636const commit = pkg . commit || "development"
3737
3838const main = async ( args : Args , cliArgs : Args , configArgs : Args ) : Promise < void > => {
39- if ( args [ "coder-link " ] ) {
40- // If we're being exposed to the cloud, we listen on a random address.
39+ if ( args [ "coder-bind " ] ) {
40+ // If we're being exposed to the cloud, we listen on a random address and disable auth .
4141 args = {
4242 ...args ,
4343 host : "localhost" ,
4444 port : 0 ,
45+ auth : AuthType . None ,
4546 }
47+ logger . info ( "coder-bind: disabling auth and listening on random localhost port" )
4648 }
4749
4850 if ( ! args . auth ) {
@@ -132,25 +134,19 @@ const main = async (args: Args, cliArgs: Args, configArgs: Args): Promise<void>
132134 httpServer . proxyDomains . forEach ( ( domain ) => logger . info ( ` - *.${ domain } ` ) )
133135 }
134136
135- coderCloudProxy ( serverAddress ! )
136-
137137 if ( serverAddress && ! options . socket && args . open ) {
138138 // The web socket doesn't seem to work if browsing with 0.0.0.0.
139139 const openAddress = serverAddress . replace ( / : \/ \/ 0 .0 .0 .0 / , "://localhost" )
140140 await open ( openAddress ) . catch ( console . error )
141141 logger . info ( `Opened ${ openAddress } ` )
142142 }
143143
144- if ( args [ "coder-link" ] ) {
145- if ( ! args [ "coder-link" ] . value ) {
146- logger . error ( "You must pass a name to link with coder cloud. See --help" )
147- process . exit ( 1 )
148- }
149-
150- logger . info ( `linking code-server to the cloud with name ${ args [ "coder-link" ] . value } ` )
144+ if ( args [ "coder-bind" ] ) {
145+ logger . info ( `linking code-server to the cloud with name ${ args [ "coder-bind" ] } ` )
151146
152147 try {
153- await coderCloudLink ( args [ "coder-link" ] . value )
148+ await coderCloudBind ( args [ "coder-bind" ] )
149+ coderCloudProxy ( serverAddress ! )
154150 } catch ( err ) {
155151 logger . error ( err . message )
156152 process . exit ( 1 )
0 commit comments