1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-19 09:43:23 +00:00

Enable alternative ways for settings passwords (#101)

* Enable alternative ways for settings passwords:
* the environment variable BW_PASSWORD
* prefix the command line argument with "file:" and the password will read from the first line of that file
* prefix the command line argument with "env:" and the password will be read from that environment variable

* Appveyor fixes

* Switch to using command options for password file and password env

* Lowercase options
This commit is contained in:
Pasi Niemi
2020-05-08 17:38:28 +03:00
committed by GitHub
parent 0092aac275
commit fb7335b927
2 changed files with 29 additions and 7 deletions

View File

@@ -1,5 +1,6 @@
import * as fs from 'fs';
import * as path from 'path';
import * as readline from 'readline';
export class NodeUtils {
static mkdirpSync(targetDir: string, mode = '700', relative = false, relativeDir: string = null) {
@@ -13,4 +14,16 @@ export class NodeUtils {
return dir;
}, initialDir);
}
static readFirstLine(fileName: string) {
return new Promise<string>((resolve, reject) => {
const readStream = fs.createReadStream(fileName, {encoding: 'utf8'});
const readInterface = readline.createInterface(readStream);
readInterface
.on('line', (line) => {
readStream.close();
resolve(line);
})
.on('error', (err) => reject(err));
});
}
}