fix: Load admin credentials from .env file

- Add dotenv dependency and load .env configuration in auth.ts
- Admin credentials now read from environment variables:
  - ADMIN_USERNAME (default: owner)
  - ADMIN_PASSWORD_HASH (default: admin123 hash)
  - ADMIN_EMAIL (default: owner@stargirlnails.de)
- Remove hardcoded admin credentials
- Add fallback values for backward compatibility
- Clear existing user storage to force recreation with new credentials
This commit is contained in:
2025-09-30 11:03:28 +02:00
parent 072c7985c7
commit af0502baa6
3 changed files with 3164 additions and 3150 deletions

View File

@@ -17,6 +17,7 @@
"@orpc/tanstack-query": "^1.8.8", "@orpc/tanstack-query": "^1.8.8",
"@tailwindcss/vite": "^4.1.12", "@tailwindcss/vite": "^4.1.12",
"@tanstack/react-query": "^5.85.5", "@tanstack/react-query": "^5.85.5",
"dotenv": "^17.2.3",
"hono": "^4.9.4", "hono": "^4.9.4",
"jsonrepair": "^3.13.0", "jsonrepair": "^3.13.0",
"openai": "^5.17.0", "openai": "^5.17.0",

9
pnpm-lock.yaml generated
View File

@@ -23,6 +23,9 @@ importers:
'@tanstack/react-query': '@tanstack/react-query':
specifier: ^5.85.5 specifier: ^5.85.5
version: 5.85.5(react@19.1.1) version: 5.85.5(react@19.1.1)
dotenv:
specifier: ^17.2.3
version: 17.2.3
hono: hono:
specifier: ^4.9.4 specifier: ^4.9.4
version: 4.9.4 version: 4.9.4
@@ -942,6 +945,10 @@ packages:
resolution: {integrity: sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==} resolution: {integrity: sha512-3UDv+G9CsCKO1WKMGw9fwq/SWJYbI0c5Y7LU1AXYoDdbhE2AHQ6N6Nb34sG8Fj7T5APy8qXDCKuuIHd1BR0tVA==}
engines: {node: '>=8'} engines: {node: '>=8'}
dotenv@17.2.3:
resolution: {integrity: sha512-JVUnt+DUIzu87TABbhPmNfVdBDt18BLOWjMUFJMSi/Qqg7NTYtabbvSNJGOJ7afbRuv9D/lngizHtP7QyLQ+9w==}
engines: {node: '>=12'}
electron-to-chromium@1.5.171: electron-to-chromium@1.5.171:
resolution: {integrity: sha512-scWpzXEJEMrGJa4Y6m/tVotb0WuvNmasv3wWVzUAeCgKU0ToFOhUW6Z+xWnRQANMYGxN4ngJXIThgBJOqzVPCQ==} resolution: {integrity: sha512-scWpzXEJEMrGJa4Y6m/tVotb0WuvNmasv3wWVzUAeCgKU0ToFOhUW6Z+xWnRQANMYGxN4ngJXIThgBJOqzVPCQ==}
@@ -2498,6 +2505,8 @@ snapshots:
detect-libc@2.0.4: {} detect-libc@2.0.4: {}
dotenv@17.2.3: {}
electron-to-chromium@1.5.171: {} electron-to-chromium@1.5.171: {}
enhanced-resolve@5.18.3: enhanced-resolve@5.18.3:

View File

@@ -2,6 +2,10 @@ import { call, os } from "@orpc/server";
import { z } from "zod"; import { z } from "zod";
import { randomUUID } from "crypto"; import { randomUUID } from "crypto";
import { createKV } from "@/server/lib/create-kv"; import { createKV } from "@/server/lib/create-kv";
import { config } from "dotenv";
// Load environment variables from .env file
config();
const UserSchema = z.object({ const UserSchema = z.object({
id: z.string(), id: z.string(),