Mint database setting (#126)

* mint: new .env variable MINT_DATABASE

* make format
This commit is contained in:
calle
2023-03-05 11:13:55 +01:00
committed by GitHub
parent a2cdd002d8
commit 39e71b20d8
4 changed files with 8 additions and 3 deletions

View File

@@ -8,6 +8,8 @@ CASHU_DIR=~/.cashu
MINT_HOST=127.0.0.1
MINT_PORT=3338
MINT_DATABASE=data/mint
# use builtin tor, this overrides SOCKS_HOST and SOCKS_PORT
TOR=TRUE

View File

@@ -44,6 +44,8 @@ MINT_URL = env.str("MINT_URL", default=None)
MINT_HOST = env.str("MINT_HOST", default="8333.space")
MINT_PORT = env.int("MINT_PORT", default=3338)
MINT_DATABASE = env.str("MINT_DATABASE", default="data/mint")
if not MINT_URL:
if MINT_HOST in ["localhost", "127.0.0.1"]:
MINT_URL = f"http://{MINT_HOST}:{MINT_PORT}"

View File

@@ -4,7 +4,7 @@ from typing import Dict, Optional
import requests
from cashu.core.settings import LNBITS_ENDPOINT, LNBITS_KEY
from cashu.core.settings import DEBUG, LNBITS_ENDPOINT, LNBITS_KEY
from .base import (
InvoiceResponse,
@@ -26,6 +26,7 @@ class LNbitsWallet(Wallet):
self.s = requests.Session()
self.s.auth = ("user", "pass")
self.s.headers.update({"X-Api-Key": key})
self.s.verify = not DEBUG
async def status(self) -> StatusResponse:
try:

View File

@@ -7,13 +7,13 @@ from loguru import logger
from cashu.core.db import Database
from cashu.core.migrations import migrate_databases
from cashu.core.settings import CASHU_DIR, LIGHTNING, MINT_PRIVATE_KEY
from cashu.core.settings import CASHU_DIR, LIGHTNING, MINT_DATABASE, MINT_PRIVATE_KEY
from cashu.lightning.lnbits import LNbitsWallet # type: ignore
from cashu.mint import migrations
from cashu.mint.ledger import Ledger
ledger = Ledger(
db=Database("mint", "data/mint"),
db=Database("mint", MINT_DATABASE),
seed=MINT_PRIVATE_KEY,
derivation_path="0/0/0/0",
lightning=LNbitsWallet(),