mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-07-22 12:22:20 +00:00
Compare commits
1 Commits
tiny-docs-
...
feat/testn
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b5524f720 |
@@ -47,6 +47,9 @@ class Settings(BaseSettings):
|
||||
receive_ln_address: str = Field(default="", env="RECEIVE_LN_ADDRESS")
|
||||
primary_mint: str = Field(default="", env="PRIMARY_MINT_URL")
|
||||
primary_mint_unit: str = Field(default="sat", env="PRIMARY_MINT_UNIT")
|
||||
disable_testnut_mock_upstream: bool = Field(
|
||||
default=False, env="DISABLE_TESTNUT_MOCK_UPSTREAM"
|
||||
)
|
||||
|
||||
# Pricing
|
||||
# Default behavior: derive pricing from MODELS
|
||||
|
||||
@@ -148,7 +148,10 @@ async def proxy(
|
||||
else:
|
||||
model_id = request_body_dict.get("model", "unknown")
|
||||
|
||||
if "https://testnut.cashu.space" in settings.cashu_mints:
|
||||
if (
|
||||
"https://testnut.cashu.space" in settings.cashu_mints
|
||||
and not settings.disable_testnut_mock_upstream
|
||||
):
|
||||
try:
|
||||
token_str = None
|
||||
if x_cashu_header := headers.get("x-cashu"):
|
||||
|
||||
@@ -218,7 +218,10 @@ async def init_upstreams() -> list[BaseUpstreamProvider]:
|
||||
results = await asyncio.gather(*tasks)
|
||||
upstreams = [p for p in results if p is not None]
|
||||
|
||||
if "https://testnut.cashu.space" in settings.cashu_mints:
|
||||
if (
|
||||
"https://testnut.cashu.space" in settings.cashu_mints
|
||||
and not settings.disable_testnut_mock_upstream
|
||||
):
|
||||
from .fake import MockUpstreamProvider
|
||||
|
||||
mock_provider = MockUpstreamProvider("mock", "mock")
|
||||
|
||||
@@ -313,7 +313,10 @@ async def periodic_payout() -> None:
|
||||
try:
|
||||
async with db.create_session() as session:
|
||||
for mint_url in settings.cashu_mints:
|
||||
if mint_url == "https://testnut.cashu.space":
|
||||
if (
|
||||
mint_url == "https://testnut.cashu.space"
|
||||
and not settings.disable_testnut_mock_upstream
|
||||
):
|
||||
continue
|
||||
for unit in ["sat", "msat"]:
|
||||
wallet = await get_wallet(mint_url, unit)
|
||||
|
||||
Reference in New Issue
Block a user