diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..08be364 --- /dev/null +++ b/.env.example @@ -0,0 +1,24 @@ +# PostgreSQL +POSTGRES_USER=postgres +POSTGRES_PASSWORD=change-me +POSTGRES_DB=tasks_db +POSTGRES_HOST=localhost +POSTGRES_PORT=5432 +# DATABASE_URL takes precedence over the POSTGRES_* values when set: +# DATABASE_URL=postgresql+psycopg2://postgres:change-me@localhost:5432/tasks_db + +# Redis — read by db/database.py and tasks.py +REDIS_HOST=localhost +REDIS_PORT=6379 +REDIS_DB=0 +# REDIS_URL takes precedence for the Redis client when set: +# REDIS_URL=redis://localhost:6379/0 +# Declared by the Docker compose files for the Redis image. +# tasks.py reads it but the broker URL does not include it (currently unused): +REDIS_PASSWORD=change-me + +# Auth (required — startup fails without these) +SECRET_KEY=replace-with-a-long-random-string +ALGORITHM=HS256 +ACCESS_TOKEN_DURATION=15 +REFRESH_TOKEN_DURATION=7 diff --git a/README.es.md b/README.es.md index 495e0b4..5327ef6 100644 --- a/README.es.md +++ b/README.es.md @@ -159,11 +159,11 @@ Crea un archivo `.env` en la raíz del proyecto. `SECRET_KEY` y `ALGORITHM` son | `POSTGRES_HOST` | `db/database.py` | — | Obligatoria | | `POSTGRES_PORT` | `db/database.py` | — | Obligatoria | | `DATABASE_URL` | `db/database.py` | — | URL completa de SQLAlchemy; tiene prioridad sobre `POSTGRES_*` | -| `REDIS_HOST` | `db/database.py` | `localhost` | | -| `REDIS_PORT` | `db/database.py` | `6379` | | -| `REDIS_DB` | `db/database.py` | `0` | | -| `REDIS_PASSWORD` | Cliente Redis | — | Obligatoria en la configuración con Docker | -| `REDIS_URL` | Celery (`tasks.py`) | — | URL del broker | +| `REDIS_HOST` | `db/database.py`, `tasks.py` | `localhost` | Host de Redis | +| `REDIS_PORT` | `db/database.py`, `tasks.py` | `6379` | Puerto de Redis | +| `REDIS_DB` | `db/database.py`, `tasks.py` | `0` | Índice de base de datos de Redis | +| `REDIS_URL` | `db/database.py` | — | Si está definida, reemplaza a `REDIS_HOST`/`REDIS_PORT`/`REDIS_DB` para el cliente Redis (se parsea en host/port/db) | +| `REDIS_PASSWORD` | Solo configuración Docker | — | Declarada por los compose files para la imagen de Redis. `tasks.py` la lee pero la URL del broker no la incluye (sin uso) | | `SECRET_KEY` | Auth | — | **Obligatoria — la aplicación falla al iniciar sin ella** | | `ALGORITHM` | Auth | — | **Obligatoria — p. ej. `HS256`** | | `ACCESS_TOKEN_DURATION` | `services/auth_services.py` | `15` | Vigencia del access token en **minutos** | @@ -185,8 +185,9 @@ POSTGRES_PORT=5432 REDIS_HOST=localhost REDIS_PORT=6379 REDIS_DB=0 +# REDIS_URL tiene prioridad para el cliente Redis cuando está definida: +# REDIS_URL=redis://localhost:6379/0 REDIS_PASSWORD=change-me -REDIS_URL=redis://localhost:6379/0 # Auth (required — startup fails without these) SECRET_KEY=replace-with-a-long-random-string @@ -214,7 +215,9 @@ Una vez que el servidor esté en ejecución: | `pytest -vv` | Ejecución en modo verbose | | `pytest --cov=./api/v1 --cov-report=html` | Cobertura de los routers → `htmlcov/index.html` | | `pytest --cov=. --cov-report=html` | Cobertura del proyecto completo → `htmlcov/index.html` | -| `src/ci-test.sh` | Entrada de CI — termina con error si un test falla | + +> `src/ci-test.sh` es solo un envoltorio de conveniencia local (se ejecuta a mano). +> CI no lo invoca: el workflow de GitHub Actions corre `pytest` directamente. Notas: @@ -230,7 +233,7 @@ Notas: - **Frontend:** - **Usuario:** `test` -- **Contraseña:** `test123` +- **Contraseña:** `test` > Estas credenciales son solo para el **frontend público de demostración**. El frontend es un cliente de demostración; el enfoque principal de este proyecto es el diseño y la arquitectura del backend. diff --git a/README.md b/README.md index 739ef6a..774265b 100644 --- a/README.md +++ b/README.md @@ -159,11 +159,11 @@ Create a `.env` file at the project root. `SECRET_KEY` and `ALGORITHM` are **req | `POSTGRES_HOST` | `db/database.py` | — | Required | | `POSTGRES_PORT` | `db/database.py` | — | Required | | `DATABASE_URL` | `db/database.py` | — | Full SQLAlchemy URL; takes precedence over `POSTGRES_*` | -| `REDIS_HOST` | `db/database.py` | `localhost` | | -| `REDIS_PORT` | `db/database.py` | `6379` | | -| `REDIS_DB` | `db/database.py` | `0` | | -| `REDIS_PASSWORD` | Redis client | — | Required in the Docker setup | -| `REDIS_URL` | Celery (`tasks.py`) | — | Broker URL | +| `REDIS_HOST` | `db/database.py`, `tasks.py` | `localhost` | Redis host | +| `REDIS_PORT` | `db/database.py`, `tasks.py` | `6379` | Redis port | +| `REDIS_DB` | `db/database.py`, `tasks.py` | `0` | Redis database index | +| `REDIS_URL` | `db/database.py` | — | When set, overrides `REDIS_HOST`/`REDIS_PORT`/`REDIS_DB` for the Redis client (parsed into host/port/db) | +| `REDIS_PASSWORD` | Docker setup only | — | Declared by the compose files for the Redis image. `tasks.py` reads it but the broker URL does not include it (unused) | | `SECRET_KEY` | auth | — | **Required — startup fails without it** | | `ALGORITHM` | auth | — | **Required — e.g. `HS256`** | | `ACCESS_TOKEN_DURATION` | `services/auth_services.py` | `15` | Access token lifetime in **minutes** | @@ -185,8 +185,9 @@ POSTGRES_PORT=5432 REDIS_HOST=localhost REDIS_PORT=6379 REDIS_DB=0 +# REDIS_URL takes precedence for the Redis client when set: +# REDIS_URL=redis://localhost:6379/0 REDIS_PASSWORD=change-me -REDIS_URL=redis://localhost:6379/0 # Auth (required — startup fails without these) SECRET_KEY=replace-with-a-long-random-string @@ -214,7 +215,9 @@ Once the server is running: | `pytest -vv` | Verbose run | | `pytest --cov=./api/v1 --cov-report=html` | Coverage of routers → `htmlcov/index.html` | | `pytest --cov=. --cov-report=html` | Full-project coverage → `htmlcov/index.html` | -| `src/ci-test.sh` | CI entrypoint — exits non-zero on test failure | + +> `src/ci-test.sh` is a local convenience wrapper only (run manually). CI does not +> invoke it: the GitHub Actions workflow runs `pytest` directly. Notes: @@ -230,7 +233,7 @@ Notes: - **Frontend:** - **Username:** `test` -- **Password:** `test123` +- **Password:** `test` > These credentials are for the **public demo frontend only**. The frontend is a demo client; the main focus of this project is the backend design and architecture.