Deprecate password flag in favor of an environment variable

This commit is contained in:
Asher 2019-04-18 11:10:55 -05:00
parent 309d15cefd
commit 55bfeab208
No known key found for this signature in database
GPG Key ID: 7BB4BA9C783D2BBC
1 changed files with 6 additions and 2 deletions

View File

@ -28,7 +28,7 @@ commander.version(process.env.VERSION || "development")
.option("-p, --port <number>", "Port to bind on.", parseInt(process.env.PORT!, 10) || 8443) .option("-p, --port <number>", "Port to bind on.", parseInt(process.env.PORT!, 10) || 8443)
.option("-N, --no-auth", "Start without requiring authentication.", undefined) .option("-N, --no-auth", "Start without requiring authentication.", undefined)
.option("-H, --allow-http", "Allow http connections.", false) .option("-H, --allow-http", "Allow http connections.", false)
.option("-P, --password <value>", "Specify a password for authentication.") .option("-P, --password <value>", "DEPRECATED: Use the PASSWORD environment variable instead. Specify a password for authentication.")
.option("--disable-telemetry", "Disables ALL telemetry.", false) .option("--disable-telemetry", "Disables ALL telemetry.", false)
.option("--install-extension <value>", "Install an extension by its ID.") .option("--install-extension <value>", "Install an extension by its ID.")
.option("--bootstrap-fork <name>", "Used for development. Never set.") .option("--bootstrap-fork <name>", "Used for development. Never set.")
@ -209,7 +209,11 @@ const bold = (text: string | number): string | number => {
} }
}); });
let password = options.password; if (options.password) {
logger.warn('"--password" is deprecated. Use the PASSWORD environment variable instead.');
}
let password = options.password || process.env.PASSWORD;
if (!password) { if (!password) {
// Generate a random password with a length of 24. // Generate a random password with a length of 24.
const buffer = Buffer.alloc(12); const buffer = Buffer.alloc(12);