diff --git a/.env.example b/.env.example index 8175395..38d7ed4 100644 --- a/.env.example +++ b/.env.example @@ -2,7 +2,7 @@ GAUTH_BASE_URL=https://auth.gnexus.space GAUTH_CLIENT_ID=change-me GAUTH_CLIENT_SECRET=change-me -GAUTH_REDIRECT_URI=https://tasks.gnexus.space/auth/callback +GAUTH_REDIRECT_URI=http://localhost:8134/auth/callback # Session cookie SESSION_SECRET=change-me-session-secret diff --git a/README.md b/README.md index 6f2d184..c95ad1a 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ ```bash cd backend uv sync # создаст .venv, установит зависимости -uv run uvicorn app.main:app --reload +uv run uvicorn app.main:app --reload --port 8134 ``` Frontend: @@ -37,7 +37,7 @@ ```bash cd frontend npm install -npm run dev # http://localhost:5173, /api проксируется на :8000 +npm run dev # http://localhost:5173, /api и /auth проксируются на :8134 ``` Прод-сборка: `docker compose up -d --build` (настройки — `.env`, шаблон `.env.example`). diff --git a/backend/Dockerfile b/backend/Dockerfile index 0315fcb..57d6bfd 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -8,5 +8,5 @@ COPY app ./app -EXPOSE 8000 -CMD ["uv", "run", "--no-dev", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000"] \ No newline at end of file +EXPOSE 8134 +CMD ["uv", "run", "--no-dev", "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8134"] \ No newline at end of file diff --git a/backend/tests/test_auth.py b/backend/tests/test_auth.py index deecdba..e1a3e07 100644 --- a/backend/tests/test_auth.py +++ b/backend/tests/test_auth.py @@ -2,6 +2,7 @@ from fastapi.testclient import TestClient +from app.config import get_settings from app.main import app client = TestClient(app) @@ -20,8 +21,9 @@ def test_login_redirects_to_sso() -> None: + base_url = get_settings().gauth_base_url resp = client.get("/auth/login", follow_redirects=False) assert resp.status_code in (302, 307) location = resp.headers["location"] - assert "auth.gnexus.space" in location + assert location.startswith(base_url) assert "state=" in location and "code_challenge=" in location diff --git a/frontend/nginx.conf b/frontend/nginx.conf index 9c6b9e6..8b9dbb5 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -10,7 +10,7 @@ } location /api/ { - proxy_pass http://api:8000; + proxy_pass http://api:8134; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index 7cdd5a8..1fa4f2f 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -7,11 +7,11 @@ server: { proxy: { '/api': { - target: 'http://localhost:8000', + target: 'http://localhost:8134', changeOrigin: true, }, '/auth': { - target: 'http://localhost:8000', + target: 'http://localhost:8134', changeOrigin: true, }, },