feat(security): implement bcrypt hashing for admin password and cleanup Dockerfile
This commit is contained in:
21
scripts/hash-password.js
Normal file
21
scripts/hash-password.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const bcrypt = require('bcryptjs');
|
||||
|
||||
const password = process.argv[2];
|
||||
|
||||
if (!password) {
|
||||
console.error('Please provide a password to hash.');
|
||||
console.error('Usage: node scripts/hash-password.js <password>');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const saltRounds = 10;
|
||||
|
||||
bcrypt.hash(password, saltRounds, (err, hash) => {
|
||||
if (err) {
|
||||
console.error('Error hashing password:', err);
|
||||
return;
|
||||
}
|
||||
console.log('Plaintext:', password);
|
||||
console.log('Bcrypt Hash:', hash);
|
||||
console.log('\nSet this hash as your ADMIN_PASSWORD environment variable.');
|
||||
});
|
||||
Reference in New Issue
Block a user