Merge pull request #136620 from filiptronicek/ft/fix-136619

Rename arg `connectionToken` to `connection-token`
This commit is contained in:
Alexandru Dima 2021-11-20 13:05:52 +01:00 committed by GitHub
commit a67d90abd0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 5 deletions

View file

@ -61,7 +61,7 @@ if (ENABLE_SYNC) {
}
// Connection Token
serverArgs.push('--connectionToken', '00000');
serverArgs.push('--connection-token', '00000');
// Server should really only listen from localhost
serverArgs.push('--host', '127.0.0.1');

View file

@ -913,9 +913,13 @@ export class RemoteExtensionHostAgentServer extends Disposable {
}
function parseConnectionToken(args: ServerParsedArgs): { connectionToken: string; connectionTokenIsMandatory: boolean; } {
if (args['connectionToken']) {
console.warn(`The argument '--connectionToken' is deprecated, please use '--connection-token' instead`);
}
if (args['connection-secret']) {
if (args['connectionToken']) {
console.warn(`Please do not use the argument connectionToken at the same time as connection-secret.`);
if (args['connection-token']) {
console.warn(`Please do not use the argument '--connection-token' at the same time as '--connection-secret'.`);
process.exit(1);
}
let rawConnectionToken = fs.readFileSync(args['connection-secret']).toString();
@ -926,7 +930,7 @@ function parseConnectionToken(args: ServerParsedArgs): { connectionToken: string
}
return { connectionToken: rawConnectionToken, connectionTokenIsMandatory: true };
} else {
return { connectionToken: args['connectionToken'] || generateUuid(), connectionTokenIsMandatory: false };
return { connectionToken: args['connection-token'] || args['connectionToken'] || generateUuid(), connectionTokenIsMandatory: false };
}
}

View file

@ -12,7 +12,8 @@ import { IEnvironmentService, INativeEnvironmentService } from 'vs/platform/envi
export const serverOptions: OptionDescriptions<ServerParsedArgs> = {
'port': { type: 'string' },
'pick-port': { type: 'string' },
'connectionToken': { type: 'string' },
'connectionToken': { type: 'string' }, // deprecated in favor of `--connection-token`
'connection-token': { type: 'string', description: nls.localize('connection-token', "A secret that must be included by the web client with all requests.") },
'connection-secret': { type: 'string', description: nls.localize('connection-secret', "Path to file that contains the connection token. This will require that all incoming connections know the secret.") },
'host': { type: 'string' },
'socket-path': { type: 'string' },
@ -60,7 +61,21 @@ export const serverOptions: OptionDescriptions<ServerParsedArgs> = {
export interface ServerParsedArgs {
port?: string;
'pick-port'?: string;
/**
* @deprecated use `connection-token` instead
*/
connectionToken?: string;
/**
* A secret token that must be provided by the web client with all requests.
* Use only `[0-9A-Za-z\-]`.
*
* By default, a UUID will be generated every time the server starts up.
*
* If the server is running on a multi-user system, then consider
* using `--connection-secret` which has the advantage that the token cannot
* be seen by other users using `ps` or similar commands.
*/
'connection-token'?: string;
/**
* A path to a filename which will be read on startup.
* Consider placing this file in a folder readable only by the same user (a `chmod 0700` directory).