use database settings for lookups
This commit is contained in:
parent
085b402fef
commit
59151232dd
13 changed files with 87 additions and 42 deletions
28
lightning.go
28
lightning.go
|
|
@ -75,7 +75,7 @@ func getGrpcConn(hostname string, port int, tlsFile, macaroonFile string) *grpc.
|
|||
|
||||
func add_invoice(amount_sat int64, metadata string) (payment_request string, r_hash []byte, return_err error) {
|
||||
|
||||
ln_port, err := strconv.Atoi(os.Getenv("LN_PORT"))
|
||||
ln_port, err := strconv.Atoi(db_get_setting("LN_PORT"))
|
||||
if err != nil {
|
||||
return "", nil, err
|
||||
}
|
||||
|
|
@ -83,10 +83,10 @@ func add_invoice(amount_sat int64, metadata string) (payment_request string, r_h
|
|||
dh := sha256.Sum256([]byte(metadata))
|
||||
|
||||
connection := getGrpcConn(
|
||||
os.Getenv("LN_HOST"),
|
||||
db_get_setting("LN_HOST"),
|
||||
ln_port,
|
||||
os.Getenv("LN_TLS_FILE"),
|
||||
os.Getenv("LN_MACAROON_FILE"))
|
||||
db_get_setting("LN_TLS_FILE"),
|
||||
db_get_setting("LN_MACAROON_FILE"))
|
||||
|
||||
l_client := lnrpc.NewLightningClient(connection)
|
||||
|
||||
|
|
@ -113,17 +113,17 @@ func monitor_invoice_state(r_hash []byte) () {
|
|||
|
||||
// get node parameters from environment variables
|
||||
|
||||
ln_port, err := strconv.Atoi(os.Getenv("LN_PORT"))
|
||||
ln_port, err := strconv.Atoi(db_get_setting("LN_PORT"))
|
||||
if err != nil {
|
||||
log.Warn(err)
|
||||
return
|
||||
}
|
||||
|
||||
connection := getGrpcConn(
|
||||
os.Getenv("LN_HOST"),
|
||||
db_get_setting("LN_HOST"),
|
||||
ln_port,
|
||||
os.Getenv("LN_TLS_FILE"),
|
||||
os.Getenv("LN_MACAROON_FILE"))
|
||||
db_get_setting("LN_TLS_FILE"),
|
||||
db_get_setting("LN_MACAROON_FILE"))
|
||||
|
||||
i_client := invoicesrpc.NewInvoicesClient(connection)
|
||||
|
||||
|
|
@ -196,28 +196,28 @@ func pay_invoice(card_payment_id int, invoice string) {
|
|||
|
||||
// get node parameters from environment variables
|
||||
|
||||
ln_port, err := strconv.Atoi(os.Getenv("LN_PORT"))
|
||||
ln_port, err := strconv.Atoi(db_get_setting("LN_PORT"))
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{"card_payment_id": card_payment_id}).Warn(err)
|
||||
return
|
||||
}
|
||||
|
||||
connection := getGrpcConn(
|
||||
os.Getenv("LN_HOST"),
|
||||
db_get_setting("LN_HOST"),
|
||||
ln_port,
|
||||
os.Getenv("LN_TLS_FILE"),
|
||||
os.Getenv("LN_MACAROON_FILE"))
|
||||
db_get_setting("LN_TLS_FILE"),
|
||||
db_get_setting("LN_MACAROON_FILE"))
|
||||
|
||||
r_client := routerrpc.NewRouterClient(connection)
|
||||
|
||||
fee_limit_sat_str := os.Getenv("FEE_LIMIT_SAT")
|
||||
fee_limit_sat_str := db_get_setting("FEE_LIMIT_SAT")
|
||||
fee_limit_sat, err := strconv.ParseInt(fee_limit_sat_str, 10, 64)
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{"card_payment_id": card_payment_id}).Warn(err)
|
||||
return
|
||||
}
|
||||
|
||||
fee_limit_percent_str := os.Getenv("FEE_LIMIT_PERCENT")
|
||||
fee_limit_percent_str := db_get_setting("FEE_LIMIT_PERCENT")
|
||||
fee_limit_percent, err := strconv.ParseFloat(fee_limit_percent_str, 64)
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{"card_payment_id": card_payment_id}).Warn(err)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue