V 2.1.0 Verbesserungen von Claude Code eingeügt

This commit is contained in:
2026-04-27 10:24:29 +02:00
parent e4d771fb65
commit 8e2fa896de
11 changed files with 85 additions and 47 deletions

View File

@@ -1,20 +1,10 @@
/**
* Reusable authentication library
* Configure users via environment variables in .env:
* AUTH_USERS=user1:$2a$10$hash1,user2:$2a$10$hash2
*
* Use scripts/generate-password.js to generate password hashes
*/
import bcrypt from 'bcryptjs';
export interface User {
username: string;
password: string;
}
/**
* Parse users from environment variable
* Format: username:password,username2:password2
*/
export function getUsers(): User[] {
const usersString = process.env.AUTH_USERS || '';
if (!usersString) {
@@ -30,21 +20,15 @@ export function getUsers(): User[] {
.filter((user) => user.username && user.password);
}
/**
* Verify user credentials
*/
export function verifyCredentials(username: string, password: string): boolean {
export async function verifyCredentials(username: string, password: string): Promise<boolean> {
const users = getUsers();
const user = users.find(u => u.username === username);
if (!user) {
return false;
}
return user.password === password;
return bcrypt.compare(password, user.password);
}
/**
* Check if authentication is enabled
*/
export function isAuthEnabled(): boolean {
return !!process.env.AUTH_USERS;
}

View File

@@ -4,8 +4,8 @@ import type { QueryResult } from 'mysql2/promise';
// Database configuration
const dbConfig = {
host: process.env.DB_HOST || 'mydbase_mysql',
user: process.env.DB_USER || 'root',
password: process.env.DB_PASS || 'SFluorit',
user: process.env.DB_USER,
password: process.env.DB_PASS,
database: process.env.DB_NAME || 'RXF',
waitForConnections: true,
connectionLimit: 10,