Skip to content

Commit 4184935

Browse files
committed
style(env): change ADMIN_PW to ADMIN_PASSWORD for consistency
1 parent e0ee251 commit 4184935

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

.env.example

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ ADMIN_USER=admin
9090
# - At least one special character (!@#$%^&*()_+-=[]{}|;:,.<>?)
9191
# Example: MySecure123!Password
9292
# NEVER commit real passwords to version control!
93-
ADMIN_PW=YourSecure12!PasswordHere
93+
ADMIN_PASSWORD=Your$ecureP@ssw0rd!
9494

9595
# =============================================================================
9696
# ACTUAL BUDGET INTEGRATION
@@ -180,7 +180,7 @@ LOG_LEVEL=info
180180
# - JWT_SECRET (32+ chars)
181181
# - JWT_REFRESH_SECRET (32+ chars, different from JWT_SECRET)
182182
# - SESSION_SECRET (32+ chars, different from JWT secrets)
183-
# - ADMIN_PW (12+ chars with complexity requirements)
183+
# - ADMIN_PASSWORD (12+ chars with complexity requirements)
184184
# - ACTUAL_SERVER_URL
185185
# - ACTUAL_PASSWORD
186186
# - ACTUAL_SYNC_ID
@@ -245,7 +245,7 @@ MAX_REQUEST_SIZE=10kb
245245
# openssl rand -hex 64 (for 64-char secrets)
246246

247247
# 2. PASSWORD HASHING:
248-
# To hash the ADMIN_PW, use:
248+
# To hash the ADMIN_PASSWORD, use:
249249
# node -e "const bcrypt = require('bcrypt'); bcrypt.hash('password', 12).then(h => console.log(h));"
250250

251251
# 3. PRODUCTION DEPLOYMENT:

src/auth/user.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,21 @@ export const validatePasswordComplexity = (password) => {
4747
export const ensureAdminUserHash = async () => {
4848
const db = getDb();
4949
const adminUsername = process.env.ADMIN_USER || 'admin';
50-
const adminPW = process.env.ADMIN_PW;
50+
const adminPassword = process.env.ADMIN_PASSWORD;
5151

52-
if (!adminPW) {
53-
logger.error('ADMIN_PW missing – cannot create admin user. Exiting.');
52+
if (!adminPassword) {
53+
logger.error('ADMIN_PASSWORD missing – cannot create admin user. Exiting.');
5454
process.exit(1);
5555
}
5656

5757
// Validate password complexity for new passwords
58-
const passwordValidation = validatePasswordComplexity(adminPW);
58+
const passwordValidation = validatePasswordComplexity(adminPassword);
5959
if (!passwordValidation.valid) {
6060
logger.warn(`Admin password does not meet complexity requirements: ${passwordValidation.message}`);
61-
logger.warn('Consider updating ADMIN_PW to meet security standards');
61+
logger.warn('Consider updating ADMIN_PASSWORD to meet security standards');
6262
}
6363

64-
const hash = await bcrypt.hash(adminPW, 12);
64+
const hash = await bcrypt.hash(adminPassword, 12);
6565

6666
const upsert = db.prepare(`
6767
INSERT INTO users (username, password_hash, is_active)

0 commit comments

Comments
 (0)