refactor __init__ functions of Wallets (funding sources)
- better error messages when a conf variable is not provided - unify approaches among different source files
This commit is contained in:
@@ -20,14 +20,22 @@ from .base import (
|
||||
|
||||
class LnTipsWallet(Wallet):
|
||||
def __init__(self):
|
||||
endpoint = settings.lntips_api_endpoint
|
||||
if not settings.lntips_api_endpoint:
|
||||
raise ValueError(
|
||||
"cannot initialize LnTipsWallet: missing lntips_api_endpoint"
|
||||
)
|
||||
key = (
|
||||
settings.lntips_api_key
|
||||
or settings.lntips_admin_key
|
||||
or settings.lntips_invoice_key
|
||||
)
|
||||
if not endpoint or not key:
|
||||
raise Exception("cannot initialize lntxbod")
|
||||
if not key:
|
||||
raise ValueError(
|
||||
"cannot initialize LnTipsWallet: "
|
||||
"missing lntips_api_key or lntips_admin_key or lntips_invoice_key"
|
||||
)
|
||||
|
||||
endpoint = settings.lntips_api_endpoint
|
||||
self.endpoint = endpoint[:-1] if endpoint.endswith("/") else endpoint
|
||||
headers = {
|
||||
"Authorization": f"Basic {key}",
|
||||
|
||||
Reference in New Issue
Block a user