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

@@ -1,45 +1,46 @@
{ {
"name": "quests-template-basic", "name": "quests-template-basic",
"private": true, "private": true,
"version": "0.0.0", "version": "0.0.0",
"type": "module", "type": "module",
"scripts": { "scripts": {
"check:types": "tsc --noEmit", "check:types": "tsc --noEmit",
"dev": "vite", "dev": "vite",
"build": "tsc -b && vite build", "build": "tsc -b && vite build",
"lint": "eslint .", "lint": "eslint .",
"lint:fix": "eslint . --fix", "lint:fix": "eslint . --fix",
"preview": "vite preview" "preview": "vite preview"
}, },
"dependencies": { "dependencies": {
"@orpc/client": "^1.8.8", "@orpc/client": "^1.8.8",
"@orpc/server": "^1.8.8", "@orpc/server": "^1.8.8",
"@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",
"hono": "^4.9.4", "dotenv": "^17.2.3",
"jsonrepair": "^3.13.0", "hono": "^4.9.4",
"openai": "^5.17.0", "jsonrepair": "^3.13.0",
"react": "^19.1.1", "openai": "^5.17.0",
"react-dom": "^19.1.1", "react": "^19.1.1",
"tailwindcss": "^4", "react-dom": "^19.1.1",
"unstorage": "^1.16.1", "tailwindcss": "^4",
"zod": "^4.0.17" "unstorage": "^1.16.1",
}, "zod": "^4.0.17"
"devDependencies": { },
"@eslint/js": "^10.0.0", "devDependencies": {
"@hono/vite-dev-server": "^0.20.1", "@eslint/js": "^10.0.0",
"@types/node": "^22", "@hono/vite-dev-server": "^0.20.1",
"@types/react": "^19", "@types/node": "^22",
"@types/react-dom": "^19", "@types/react": "^19",
"@vitejs/plugin-react": "^5.0.1", "@types/react-dom": "^19",
"eslint": "^9", "@vitejs/plugin-react": "^5.0.1",
"eslint-plugin-react-hooks": "^6.0.0", "eslint": "^9",
"eslint-plugin-react-refresh": "^0.4.20", "eslint-plugin-react-hooks": "^6.0.0",
"globals": "^16.3.0", "eslint-plugin-react-refresh": "^0.4.20",
"typescript": "^5", "globals": "^16.3.0",
"typescript-eslint": "^8.40.0", "typescript": "^5",
"vite": "^7.1.3", "typescript-eslint": "^8.40.0",
"vite-tsconfig-paths": "^5.1.4" "vite": "^7.1.3",
} "vite-tsconfig-paths": "^5.1.4"
} }
}

6219
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

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(),