feat: add extension-settings instead of environs (#28)
* feat: add extension-settings instead of environs
This commit is contained in:
parent
257f5d34d2
commit
f2e419e18d
10 changed files with 230 additions and 130 deletions
18
__init__.py
18
__init__.py
|
|
@ -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")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue