adrienemery / lnd-grpc-client

A python grpc client/async client for LND ⚡⚡⚡
MIT License
34 stars 20 forks source link

Running on flask in production #6

Closed ekerstein closed 6 years ago

ekerstein commented 6 years ago

I'm having trouble running this in Flask in production. Running on localhost the exact same code works fine. I'm thinking it has to do with a permission issue. How do I make sure that my Flask site can execute the code?

from lndgrpc import LNDClient # for LND rpc

def addInvoice(amount, memo):
    INVOICE_MACAROON_FILEPATH = '/home/ekerstein/.lnd/invoice.macaroon'
    lnd = LNDClient('127.0.0.1:10009', macaroon_filepath=INVOICE_MACAROON_FILEPATH)
    return lnd.add_invoice(amount, memo).payment_request

@app.route("/addinvoice")
def add_invoice():
    amount = request.args.get('amount', type = int)
    memo = request.args.get('memo', type = str)
    return jsonify(addInvoice(amount, memo))