Add Readme

This commit is contained in:
2026-03-14 14:55:30 +01:00
parent 517149e2ff
commit cb098cb139
3 changed files with 39 additions and 9 deletions

View File

@@ -0,0 +1,27 @@
# Allmende Payment System
A FastAPI-based payment system for the communal living projects and similar groups.
## Prerequisites
- [uv](https://docs.astral.sh/uv/) (package and dependency manager)
## Getting Started
### 1. Install uv
Ensure `uv` is installed. If not, follow the [official installation guide](https://docs.astral.sh/uv/getting-started/installation/).
### 2. Initialize the database
```bash
make reset_db
```
Resets the database and initializes it with some mock data.
### 3. Run the Development Server
```bash
uv run fastapi dev src/allmende_payment_system/app.py
```
A demo user will be created automatically.
## License
This project is licensed under the [European Union Public Licence (EUPL)](https://joinup.ec.europa.eu/collection/eupl).

View File

@@ -14,7 +14,7 @@ dependencies = [
] ]
[project.scripts] [project.scripts]
allmende-payment-system = "allmende_payment_system:main" aps = "allmende_payment_system.cli:main"
[build-system] [build-system]
requires = ["uv_build>=0.9.2,<0.10.0"] requires = ["uv_build>=0.9.2,<0.10.0"]

View File

@@ -22,19 +22,22 @@ SessionDep = Annotated[Session, Depends(get_session)]
async def get_user(request: Request) -> dict: async def get_user(request: Request) -> dict:
if username := os.environ.get("APS_username", None): if "ynh_user" in request.headers:
return { # if the ynh_user header is present, we assume we're running in YunoHost and use the header values
"username": username,
"display_name": os.environ.get("APS_display_name", "Missing Display Name"),
}
if "ynh_user" not in request.headers:
raise HTTPException(status_code=401, detail="Missing ynh_user header")
return { return {
"username": request.headers["ynh_user"], "username": request.headers["ynh_user"],
"display_name": request.headers["ynh_user_fullname"], "display_name": request.headers["ynh_user_fullname"],
} }
if not "APS_PRODUCTION_MODE" in os.environ:
username = os.environ.get("APS_username", "demo_user")
return {
"username": username,
"display_name": username,
}
raise HTTPException(status_code=401, detail="Missing ynh_user header")
async def get_user_object(request: Request, session: SessionDep) -> User: async def get_user_object(request: Request, session: SessionDep) -> User: