Add Readme
This commit is contained in:
27
README.md
27
README.md
@@ -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).
|
||||
|
||||
@@ -14,7 +14,7 @@ dependencies = [
|
||||
]
|
||||
|
||||
[project.scripts]
|
||||
allmende-payment-system = "allmende_payment_system:main"
|
||||
aps = "allmende_payment_system.cli:main"
|
||||
|
||||
[build-system]
|
||||
requires = ["uv_build>=0.9.2,<0.10.0"]
|
||||
|
||||
@@ -22,19 +22,22 @@ SessionDep = Annotated[Session, Depends(get_session)]
|
||||
|
||||
async def get_user(request: Request) -> dict:
|
||||
|
||||
if username := os.environ.get("APS_username", None):
|
||||
return {
|
||||
"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")
|
||||
|
||||
if "ynh_user" in request.headers:
|
||||
# if the ynh_user header is present, we assume we're running in YunoHost and use the header values
|
||||
return {
|
||||
"username": request.headers["ynh_user"],
|
||||
"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:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user