nas-samba v1.0.1: health check, hostname, remove demo credentials

- Add health check (curl /api/health) so Traefik can verify container health
- Set container hostname to nas.alexzaw.dev
- Remove hardcoded demo credentials from login page
- Remove admin123 fallback password — require SMB_PASSWORD env var
- Fail fast if no admin password is configured
This commit is contained in:
2026-04-26 05:13:01 +00:00
parent 5b213d8e51
commit 3c67eb75c3
14 changed files with 36 additions and 43 deletions

View File

@@ -28,7 +28,7 @@ const JWT_SECRET = process.env.JWT_SECRET || 'cloudsync_secret_key';
const JWT_ALGORITHM = 'HS256';
const JWT_EXPIRATION_HOURS = 24;
const ADMIN_USERNAME = process.env.ADMIN_USERNAME || 'alexz';
const ADMIN_PASSWORD = process.env.ADMIN_PASSWORD || process.env.SMB_PASSWORD || 'admin123';
const ADMIN_PASSWORD = process.env.ADMIN_PASSWORD || process.env.SMB_PASSWORD;
// ---------------------------------------------------------------------------
// SQLite setup
@@ -1461,6 +1461,10 @@ app.get('*', (_req, res) => {
// Seed admin user
// ---------------------------------------------------------------------------
function seedAdmin() {
if (!ADMIN_PASSWORD) {
console.error('FATAL: No admin password configured. Set SMB_PASSWORD or ADMIN_PASSWORD.');
process.exit(1);
}
const count = sqlDb.prepare('SELECT COUNT(*) as count FROM users').get().count;
if (count === 0) {
const adminId = crypto.randomUUID();