feat: add extension-settings instead of environs (#28)

* feat: add extension-settings instead of environs
This commit is contained in:
dni ⚡ 2023-11-22 11:40:22 +01:00 committed by GitHub
commit f2e419e18d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 230 additions and 130 deletions

View file

@ -9,24 +9,6 @@ from lnbits.db import Database
from lnbits.helpers import template_renderer
from lnbits.tasks import catch_everything_and_restart
from .nostr.event import Event
from .nostr.key import PrivateKey, PublicKey
def generate_keys(private_key: str = ""):
if private_key.startswith("nsec"):
return PrivateKey.from_nsec(private_key)
elif private_key:
return PrivateKey(bytes.fromhex(private_key))
else:
return PrivateKey() # generate random key
env = Env()
env.read_env()
nostr_privatekey = generate_keys(env.str("LNURLP_ZAP_NOSTR_PRIVATEKEY", default=""))
nostr_publickey: PublicKey = nostr_privatekey.public_key
logger.debug(f"LNURLP Zaps Nostr pubkey: {nostr_publickey.hex()}")
db = Database("ext_lnurlp")