feat: add production deployment config
- Add docker-compose.prod.yml and Caddyfile for Caddy reverse proxy - Add production stages to frontend Dockerfile (nginx for static files) - Fix monorepo package exports for production builds (dist/src paths) - Add CORS_ORIGIN env var for cross-origin config - Add Better Auth baseURL, cookie domain, and trusted origins from env - Use VITE_API_URL for API calls in auth-client and play route - Add credentials: include for cross-origin fetch requests - Remove unused users table from schema
This commit is contained in:
parent
3f7bc4111e
commit
bc38137a12
20 changed files with 421515 additions and 34 deletions
|
|
@ -7,6 +7,8 @@ import { GameSetup } from "../components/game/GameSetup";
|
|||
import { authClient } from "../lib/auth-client";
|
||||
|
||||
function Play() {
|
||||
const API_URL = import.meta.env["VITE_API_URL"] || "";
|
||||
|
||||
const [gameSession, setGameSession] = useState<GameSession | null>(null);
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [currentQuestionIndex, setCurrentQuestionIndex] = useState(0);
|
||||
|
|
@ -15,9 +17,10 @@ function Play() {
|
|||
|
||||
const startGame = useCallback(async (settings: GameRequest) => {
|
||||
setIsLoading(true);
|
||||
const response = await fetch("/api/v1/game/start", {
|
||||
const response = await fetch(`${API_URL}/api/v1/game/start`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
credentials: "include",
|
||||
body: JSON.stringify(settings),
|
||||
});
|
||||
const data = await response.json();
|
||||
|
|
@ -42,9 +45,10 @@ function Play() {
|
|||
const question = gameSession.questions[currentQuestionIndex];
|
||||
if (!question) return;
|
||||
|
||||
const response = await fetch("/api/v1/game/answer", {
|
||||
const response = await fetch(`${API_URL}/api/v1/game/answer`, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
credentials: "include",
|
||||
body: JSON.stringify({
|
||||
sessionId: gameSession.sessionId,
|
||||
questionId: question.questionId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue