Browse Source

Trim newlines when reading PASSWORD_FILE

pull/407/head^2
Josh Thorpe 3 years ago
committed by GitHub
parent
commit
fb00990f42
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      src/config.js

2
src/config.js

@ -10,7 +10,7 @@ module.exports.PASSWORD = process.env.PASSWORD;
// if not, then print the error and proceed // if not, then print the error and proceed
if ('PASSWORD_FILE' in process.env && fs.existsSync(process.env.PASSWORD_FILE)) { if ('PASSWORD_FILE' in process.env && fs.existsSync(process.env.PASSWORD_FILE)) {
try { try {
module.exports.PASSWORD = fs.readFileSync(process.env.PASSWORD_FILE, 'utf8'); module.exports.PASSWORD = fs.readFileSync(process.env.PASSWORD_FILE, 'utf8').replace(/[\n\r]/g, '');
} catch (err) { } catch (err) {
console.error('Could not load the PASSWORD_FILE, using the contents of the PASSWORD variable instead'); console.error('Could not load the PASSWORD_FILE, using the contents of the PASSWORD variable instead');
} }

Loading…
Cancel
Save