diff --git a/README.md b/README.md index 78d1ea0..298168f 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,8 @@ database: uri: "" ``` +Replace `` with your actual connection string including the database name and any required credentials (for example: `mongodb://localhost:27017/your_database_name`). Do not commit real connection strings or credentials to version control. + Without a valid MongoDB URI, the backend will fail to start. --- diff --git a/backend/config/config.prod.sample.yml b/backend/config/config.prod.sample.yml index 48a187c..7996758 100644 --- a/backend/config/config.prod.sample.yml +++ b/backend/config/config.prod.sample.yml @@ -2,9 +2,9 @@ server: port: 1313 # The port number your backend server will run on database: - uri: "mongodb+srv://:@/" - # Replace with your MongoDB Atlas connection string - # Get this from your MongoDB Atlas dashboard after creating a cluster and database + uri: "" + # Replace with your MongoDB connection string (include DB name/credentials) + # Example: mongodb://localhost:27017/your_database_name or a MongoDB Atlas URI gemini: apiKey: "" diff --git a/backend/config/config.prod.yml b/backend/config/config.prod.yml new file mode 100644 index 0000000..e849dd5 --- /dev/null +++ b/backend/config/config.prod.yml @@ -0,0 +1,43 @@ +server: + port: 1313 # The port number your backend server will run on + +database: + uri: "mongodb://localhost:27017" + # Replace with your MongoDB Atlas connection string + # Get this from your MongoDB Atlas dashboard after creating a cluster and database + +gemini: + apiKey: "" + # API key for OpenAI / Gemini model access + # Obtain from your OpenRouter.ai or OpenAI account dashboard + +jwt: + secret: "" + # A secret string used to sign JWT tokens + # Generate a strong random string (e.g. use `openssl rand -hex 32`) + + expiry: 1440 + # Token expiry time in minutes (e.g. 1440 = 24 hours) + +smtp: + host: "smtp.gmail.com" + # SMTP server host for sending emails (example is Gmail SMTP) + + port: 587 + # SMTP server port (587 for TLS) + + username: "" + # Email username (your email address) + + password: "" + # Password for the email or app-specific password if 2FA is enabled + + senderEmail: "" + # The 'from' email address used when sending mails + + senderName: "DebateAI Team" + +googleOAuth: + clientID: "" + # Google OAuth Client ID for OAuth login + # Obtain from Google Cloud Console (APIs & Services > Credentials > OAuth 2.0 Client IDs) diff --git a/frontend/src/Pages/Admin/AdminDashboard.tsx b/frontend/src/Pages/Admin/AdminDashboard.tsx index 512dca1..be5698a 100644 --- a/frontend/src/Pages/Admin/AdminDashboard.tsx +++ b/frontend/src/Pages/Admin/AdminDashboard.tsx @@ -18,6 +18,7 @@ import { type Admin, } from "@/services/adminService"; import { Button } from "@/components/ui/button"; +import { getLocalString, getLocalJSON } from "@/utils/storage"; import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { @@ -364,15 +365,15 @@ export default function AdminDashboard() { }, []); useEffect(() => { - const adminToken = localStorage.getItem("adminToken"); - const adminData = localStorage.getItem("admin"); + const adminToken = getLocalString("adminToken"); + const adminData = getLocalJSON("admin"); if (!adminToken || !adminData) { navigate("/admin/login"); return; } setToken(adminToken); - setAdmin(JSON.parse(adminData)); + setAdmin(adminData); loadData(adminToken); }, [loadData, navigate]); @@ -504,8 +505,8 @@ export default function AdminDashboard() { No analytics data available yet.