Disable BTCPay in the interface, if BTCPAY_PRIVATE_KEY is un-set #3
No reviewers
Labels
No Label
No Milestone
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: 3wordchant/capsul-flask#3
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "optional-btcpay"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I'm potentially interested in working out how BTCpay works at some point, but it's doesn't seem necessary for our trial run, so it'd be helpful to be able to hide it in Capsul if it's not configured.
These changes hide the link to
/payment/btcpay
, and prevent that page from loading, ifBTCPAY_PRIVATE_KEY
is not set.LGTM.
Probably more intuitive to have a
BTCPAY_ENABLED=true/false
?But again, this looks fine as-is.
Yeah, fair point, maybe a further change to make in future? My thinking was that
BTCPAY_PRIVATE_KEY
is blank by default, so the flow of "first set-up = no BTCPay", "add BTCPay private key = enabled" didn't seem terrible, but yes, still not as explicit as it could be.I changed this a little bit:
Is that ok? I thought it might be better to avoid tying the config structure to the template files. So config values would have to be passed explicitly, like:
BTCPAY_ENABLED
boolean config value get automatically set depending onapp.config['BTCPAY_URL'] is not ""
andbtcpay.Client(api_uri=app.config['BTCPAY_URL'], pem=app.config['BTCPAY_PRIVATE_KEY'])
does not raise an exception (i.e. the key is valid)Does that sound good ?
OK, looks excellent, merging!
@ -73,3 +72,3 @@
BTCPAY_PRIVATE_KEY=os.environ.get("BTCPAY_PRIVATE_KEY", default="").replace("\\n", "\n"),
BTCPAY_URL=os.environ.get("BTCPAY_URL", default="https://btcpay.cyberia.club")
BTCPAY_URL=os.environ.get("BTCPAY_URL", default="")
Ah, greatlooks. I didn't wanna complicate things for Cyberia's deployment, but this seems like a good generic default