Skip to content

Conversation

@MyDrift-user
Copy link
Member

Type of Change

  • New feature
  • Refactoring

Description

  • remove usage of GET for most endpoints, improve on existing ones. add secure authentication using postgresql + redis for caching.

- Changed all API endpoint methods from GET to POST in configuration files and updated handler logic to accept parameters via a Pydantic request body model.
- Introduced in-memory session management with secure cookie handling, added authentication dependencies, and implemented secure login/logout endpoints under /api/secure.
- Added a /files proxy route for authenticated file access from Moodle, replacing insecure token-in-URL patterns.
- Updated CORS handling for dynamic origin reflection
- Refactored compose.yaml to use .env
- Updated requirements for httpx[http2].
- Introduces an async lifespan context manager that periodically cleans up expired sessions using a background task.
- The session cleanup runs every SESSION_MAX_AGE seconds and logs the number of sessions removed or any errors encountered. - The cleanup task is properly cancelled on application shutdown.
- Session management has been refactored to use Redis for storage instead of in-memory dictionaries. This includes async session functions, Redis initialization in app lifespan, and automatic session expiration via Redis.
- The .env.example and compose.yaml files were updated to add Redis configuration, and requirements.txt now includes the redis package.
- All session-related code and dependencies have been updated to support async Redis operations.
Switches to a multi-stage build using python:3.13-alpine for both build and runtime stages to reduce image size.
- Installs build dependencies only in the builder stage and copies only the necessary Python packages and application code to the final image.
- Refactored CORS configuration to use allow_origin_regex for wildcard origins with credentials, exposing 'X-Request-Id' header and setting max_age.
- Changed secure authentication route prefix from '/api/secure' to '/secure' for consistency.
Added Postgres service to compose.yaml and updated environment variables in .env.example for database configuration. Improved organization and clarity of environment variables, and ensured all services use a shared network for better connectivity.
Changed the default MOODLE_URL environment variable
@MyDrift-user MyDrift-user merged commit eec0ca1 into main Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants