From 939a991d6b7f2123f3fa0acf3cee6873f078aacf Mon Sep 17 00:00:00 2001 From: Shroominic Date: Mon, 8 Sep 2025 10:53:41 +0100 Subject: [PATCH] chore: update version/readme; minor auth logging and settings usage --- README.md | 2 +- routstr/__init__.py | 4 ---- routstr/auth.py | 12 ++++-------- 3 files changed, 5 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 861cad8f..07d25fe9 100644 --- a/README.md +++ b/README.md @@ -91,7 +91,7 @@ The most common settings are shown below. See `.env.example` for the full list. - `UPSTREAM_BASE_URL` – URL of the OpenAI-compatible service - `UPSTREAM_API_KEY` – API key for the upstream service (optional) -- `MODEL_BASED_PRICING` – Set to `true` to use pricing from `models.json` +- `FIXED_PRICING` – Set to `true` to use a fixed per-request price; `false` (default) uses model pricing from `models.json` - `ADMIN_PASSWORD` – Password for the `/admin/` dashboard - `CASHU_MINTS` – Comma-separated list of Cashu mint URLs - `NAME` – Name of the proxy diff --git a/routstr/__init__.py b/routstr/__init__.py index 7a1bc151..1bdd854c 100644 --- a/routstr/__init__.py +++ b/routstr/__init__.py @@ -1,7 +1,3 @@ -import dotenv - -dotenv.load_dotenv() - from .core.main import app as fastapi_app # noqa __all__ = ["fastapi_app"] diff --git a/routstr/auth.py b/routstr/auth.py index 6202a69a..c6c46592 100644 --- a/routstr/auth.py +++ b/routstr/auth.py @@ -7,18 +7,14 @@ from sqlmodel import col, update from .core import get_logger from .core.db import ApiKey, AsyncSession +from .core.settings import settings from .payment.cost_caculation import ( CostData, CostDataError, MaxCostData, calculate_cost, ) -from .wallet import ( - PRIMARY_MINT_URL, - TRUSTED_MINTS, - credit_balance, - deserialize_token_from_string, -) +from .wallet import credit_balance, deserialize_token_from_string logger = get_logger(__name__) @@ -165,12 +161,12 @@ async def validate_bearer_key( "has_expiry_time": bool(key_expiry_time), }, ) - if token_obj.mint in TRUSTED_MINTS: + if token_obj.mint in settings.cashu_mints: refund_currency = token_obj.unit refund_mint_url = token_obj.mint else: refund_currency = "sat" - refund_mint_url = PRIMARY_MINT_URL + refund_mint_url = settings.primary_mint new_key = ApiKey( hashed_key=hashed_key,