Skip to content

Conversation

@btwiuse
Copy link
Contributor

@btwiuse btwiuse commented Mar 16, 2024

Expose the --server-base-path option in code serve-web command

Companion to #202491

To test if it works, build the cli with these environment variables:

export VSCODE_CLI_QUALITY=insiders
export VSCODE_CLI_UPDATE_URL=https://update.code.visualstudio.com
export VSCODE_CLI_TUNNEL_SERVER_QUALITIES='{"insider":{"serverApplicationName":"code-server-insiders"}}'

Start the server on /abc:

./target/debug/code serve-web --server-base-path /abc 

Web UI available at http://127.0.0.1:8000/abc?tkn=67a8ca19-b8a3-4502-ae0f-172c60638aa7

The option will be available in code serve-web --help:

$ ./target/debug/code serve-web --help
Runs a local web version of Code - OSS

Usage: code serve-web [OPTIONS]

Options:
      --host <HOST>
          Host to listen on, defaults to 'localhost'
      --socket-path <SOCKET_PATH>

      --port <PORT>
          Port to listen on. If 0 is passed a random free port is picked [default: 8000]                                           
      --connection-token <CONNECTION_TOKEN>
          A secret that must be included with all requests
      --connection-token-file <CONNECTION_TOKEN_FILE>
          A file containing a secret that must be included with all requests                                                       
      --without-connection-token
          Run without a connection token. Only use this if the connection is secured by other means                                
      --accept-server-license-terms
          If set, the user accepts the server license terms and the server will be started without a user prompt                   
      --server-base-path <SERVER_BASE_PATH>
          Specifies the path under which the web UI and the code server is provided                                                
      --server-data-dir <SERVER_DATA_DIR>
          Specifies the directory that server data is kept in
      --user-data-dir <USER_DATA_DIR>
          Specifies the directory that user data is kept in. Can be used to open multiple distinct instances of Code               
      --extensions-dir <EXTENSIONS_DIR>
          Set the root path for extensions
  -h, --help
          Print help

GLOBAL OPTIONS:
      --cli-data-dir <CLI_DATA_DIR>  Directory where CLI metadata should be stored [env: VSCODE_CLI_DATA_DIR=]                     
      --verbose                      Print verbose output (implies --wait)                                                         
      --log <level>                  Log level to use [possible values: trace, debug, info, warn, error, critical, off]
@btwiuse
Copy link
Contributor Author

btwiuse commented Mar 16, 2024

@microsoft-github-policy-service agree

@chrmarti chrmarti assigned aeschli and unassigned chrmarti Mar 18, 2024
@vscodenpa vscodenpa added this to the March 2024 milestone Mar 18, 2024
@aeschli aeschli requested a review from connor4312 March 18, 2024 13:53
@connor4312
Copy link
Member

Thanks! This was on my todo :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

6 participants