Accept argument to change initial working directory
This commit is contained in:
parent
e22791ec88
commit
8dcc1e3567
58
README.md
58
README.md
@ -5,7 +5,8 @@
|
|||||||
[![MIT license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/cdr/code-server/blob/master/LICENSE)
|
[![MIT license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/cdr/code-server/blob/master/LICENSE)
|
||||||
[![Discord](https://img.shields.io/discord/463752820026376202.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/zxSwN8Z)
|
[![Discord](https://img.shields.io/discord/463752820026376202.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2)](https://discord.gg/zxSwN8Z)
|
||||||
|
|
||||||
`code-server` is [VS Code](https://github.com/Microsoft/vscode) running on a remote server, accessible through the browser.
|
`code-server` is [VS Code](https://github.com/Microsoft/vscode) running on a
|
||||||
|
remote server, accessible through the browser.
|
||||||
|
|
||||||
Try it out:
|
Try it out:
|
||||||
```bash
|
```bash
|
||||||
@ -29,28 +30,35 @@ Use [sshcode](https://github.com/codercom/sshcode) for a simple setup.
|
|||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
See docker oneliner mentioned above. Dockerfile is at [/Dockerfile](/Dockerfile).
|
See docker oneliner mentioned above. Dockerfile is at
|
||||||
|
[/Dockerfile](/Dockerfile).
|
||||||
|
|
||||||
### Binaries
|
### Binaries
|
||||||
|
|
||||||
1. [Download a binary](https://github.com/cdr/code-server/releases) (Linux and OS X supported. Windows coming soon)
|
1. [Download a binary](https://github.com/cdr/code-server/releases) (Linux and
|
||||||
|
OS X supported. Windows coming soon)
|
||||||
2. Start the binary with the project directory as the first argument
|
2. Start the binary with the project directory as the first argument
|
||||||
|
|
||||||
```
|
```
|
||||||
code-server <initial directory to open>
|
code-server <initial directory to open>
|
||||||
```
|
```
|
||||||
> You will be prompted to enter the password shown in the CLI
|
You will be prompted to enter the password shown in the CLI. `code-server`
|
||||||
`code-server` should now be running at https://localhost:8443.
|
should now be running at https://localhost:8443.
|
||||||
|
|
||||||
> code-server uses a self-signed SSL certificate that may prompt your browser to ask you some additional questions before you proceed. Please [read here](doc/self-hosted/index.md) for more information.
|
`code-server` uses a self-signed SSL certificate that may prompt your
|
||||||
|
browser to ask you some additional questions before you proceed. Please
|
||||||
|
[read here](doc/self-hosted/index.md) for more information.
|
||||||
|
|
||||||
For detailed instructions and troubleshooting, see the [self-hosted quick start guide](doc/self-hosted/index.md).
|
For detailed instructions and troubleshooting, see the
|
||||||
|
[self-hosted quick start guide](doc/self-hosted/index.md).
|
||||||
|
|
||||||
Quickstart guides for [Google Cloud](doc/admin/install/google_cloud.md), [AWS](doc/admin/install/aws.md), and [DigitalOcean](doc/admin/install/digitalocean.md).
|
Quickstart guides for [Google Cloud](doc/admin/install/google_cloud.md),
|
||||||
|
[AWS](doc/admin/install/aws.md), and
|
||||||
|
[DigitalOcean](doc/admin/install/digitalocean.md).
|
||||||
|
|
||||||
How to [secure your setup](/doc/security/ssl.md).
|
How to [secure your setup](/doc/security/ssl.md).
|
||||||
|
|
||||||
## Build
|
### Build
|
||||||
- If you also plan on developing, set the `OUT` environment variable: `
|
- If you also plan on developing, set the `OUT` environment variable: `
|
||||||
export OUT=/path/to/some/directory`. Otherwise it will build in this
|
export OUT=/path/to/some/directory`. Otherwise it will build in this
|
||||||
directory which will cause issues because then `yarn watch` will try to
|
directory which will cause issues because then `yarn watch` will try to
|
||||||
@ -62,7 +70,7 @@ How to [secure your setup](/doc/security/ssl.md).
|
|||||||
`yarn binary` with the same arguments in the previous step to package the
|
`yarn binary` with the same arguments in the previous step to package the
|
||||||
code into a single binary.
|
code into a single binary.
|
||||||
|
|
||||||
## Development
|
### Development
|
||||||
|
|
||||||
```fish
|
```fish
|
||||||
git clone https://github.com/microsoft/vscode
|
git clone https://github.com/microsoft/vscode
|
||||||
@ -77,25 +85,31 @@ yarn start --allow-http --no-auth
|
|||||||
# Visit http://localhost:8443
|
# Visit http://localhost:8443
|
||||||
```
|
```
|
||||||
|
|
||||||
### Known Issues
|
## Known Issues
|
||||||
|
|
||||||
- Creating custom VS Code extensions and debugging them doesn't work.
|
- Creating custom VS Code extensions and debugging them doesn't work.
|
||||||
- To debug Golang using [ms-vscode-go extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.Go), you need to add `--security-opt seccomp=unconfined` to your `docker run` arguments when launching code-server with Docker. See [#725](https://github.com/cdr/code-server/issues/725) for details.
|
- To debug Golang using
|
||||||
|
[ms-vscode-go extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode.Go),
|
||||||
|
you need to add `--security-opt seccomp=unconfined` to your `docker run`
|
||||||
|
arguments when launching code-server with Docker. See
|
||||||
|
[#725](https://github.com/cdr/code-server/issues/725) for details.
|
||||||
|
|
||||||
### Future
|
## Future
|
||||||
- **Stay up to date!** Get notified about new releases of code-server.
|
- **Stay up to date!** Get notified about new releases of code-server.
|
||||||
![Screenshot](/doc/assets/release.gif)
|
![Screenshot](/doc/assets/release.gif)
|
||||||
- Windows support.
|
- Windows support.
|
||||||
- Electron and Chrome OS applications to bridge the gap between local<->remote.
|
- Electron and Chrome OS applications to bridge the gap between local<->remote.
|
||||||
- Run VS Code unit tests against our builds to ensure features work as expected.
|
- Run VS Code unit tests against our builds to ensure features work as expected.
|
||||||
|
|
||||||
### Extensions
|
## Extensions
|
||||||
|
|
||||||
At the moment we can't use the official VSCode Marketplace. We've created a custom extension marketplace focused around open-sourced extensions. However, if you have access to the `.vsix` file, you can manually install the extension.
|
At the moment we can't use the official VSCode Marketplace. We've created a
|
||||||
|
custom extension marketplace focused around open-sourced extensions. However,
|
||||||
|
if you have access to the `.vsix` file, you can manually install the extension.
|
||||||
|
|
||||||
## Telemetry
|
## Telemetry
|
||||||
|
|
||||||
Use the `--disable-telemetry` flag or set `DISABLE_TELEMETRY=true` to disable tracking ENTIRELY.
|
Set the `telemetry.enableTelemetry` user setting to false to disable telemetry.
|
||||||
|
|
||||||
We use data collected to improve code-server.
|
We use data collected to improve code-server.
|
||||||
|
|
||||||
@ -109,8 +123,10 @@ Development guides are coming soon.
|
|||||||
|
|
||||||
## Enterprise
|
## Enterprise
|
||||||
|
|
||||||
Visit [our enterprise page](https://coder.com/enterprise) for more information about our enterprise offering.
|
Visit [our enterprise page](https://coder.com/enterprise) for more information
|
||||||
|
about our enterprise offering.
|
||||||
|
|
||||||
## Commercialization
|
## Commercialization
|
||||||
|
|
||||||
If you would like to commercialize code-server, please contact contact@coder.com.
|
If you would like to commercialize code-server, please contact
|
||||||
|
contact@coder.com.
|
||||||
|
@ -127,6 +127,9 @@ const main = async (): Promise<void> => {
|
|||||||
certKey: args["cert-key"],
|
certKey: args["cert-key"],
|
||||||
auth: typeof args.auth !== "undefined" ? args.auth : true,
|
auth: typeof args.auth !== "undefined" ? args.auth : true,
|
||||||
password: process.env.PASSWORD,
|
password: process.env.PASSWORD,
|
||||||
|
folderUri: args["_"] && args["_"].length > 1
|
||||||
|
? args["_"][args["_"].length - 1]
|
||||||
|
: undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!options.host) {
|
if (!options.host) {
|
||||||
|
@ -97,6 +97,7 @@ export interface ServerOptions {
|
|||||||
readonly certKey?: string;
|
readonly certKey?: string;
|
||||||
readonly auth?: boolean;
|
readonly auth?: boolean;
|
||||||
readonly password?: string;
|
readonly password?: string;
|
||||||
|
readonly folderUri?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export abstract class Server {
|
export abstract class Server {
|
||||||
@ -107,7 +108,7 @@ export abstract class Server {
|
|||||||
|
|
||||||
private listenPromise: Promise<string> | undefined;
|
private listenPromise: Promise<string> | undefined;
|
||||||
|
|
||||||
public constructor(private readonly options: ServerOptions) {
|
public constructor(protected readonly options: ServerOptions) {
|
||||||
if (this.options.cert && this.options.certKey) {
|
if (this.options.cert && this.options.certKey) {
|
||||||
useHttpsTransformer();
|
useHttpsTransformer();
|
||||||
const httpolyglot = require.__$__nodeRequire(path.resolve(__dirname, "../node_modules/httpolyglot/lib/index")) as typeof import("httpolyglot");
|
const httpolyglot = require.__$__nodeRequire(path.resolve(__dirname, "../node_modules/httpolyglot/lib/index")) as typeof import("httpolyglot");
|
||||||
@ -458,7 +459,7 @@ export class MainServer extends Server {
|
|||||||
|
|
||||||
const cwd = process.env.VSCODE_CWD || process.cwd();
|
const cwd = process.env.VSCODE_CWD || process.cwd();
|
||||||
const workspacePath = parsedUrl.query.workspace as string | undefined;
|
const workspacePath = parsedUrl.query.workspace as string | undefined;
|
||||||
const folderPath = !workspacePath ? parsedUrl.query.folder as string | undefined || cwd: undefined;
|
const folderPath = !workspacePath ? parsedUrl.query.folder as string | undefined || this.options.folderUri || cwd: undefined;
|
||||||
|
|
||||||
const options: Options = {
|
const options: Options = {
|
||||||
WORKBENCH_WEB_CONGIGURATION: {
|
WORKBENCH_WEB_CONGIGURATION: {
|
||||||
|
Reference in New Issue
Block a user