flag
This commit is contained in:
parent
8918703204
commit
765f488f09
4 changed files with 6 additions and 0 deletions
|
|
@ -43,3 +43,4 @@ MIGRATE_DB=false
|
||||||
#METRICS
|
#METRICS
|
||||||
RECORD_PERFORMANCE=true
|
RECORD_PERFORMANCE=true
|
||||||
SKIP_SANITY_CHECK=false
|
SKIP_SANITY_CHECK=false
|
||||||
|
DISABLE_EXTERNAL_PAYMENTS=false
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,7 @@ export const LoadMainSettingsFromEnv = (test = false): MainSettings => {
|
||||||
servicePort: EnvMustBeInteger("PORT"),
|
servicePort: EnvMustBeInteger("PORT"),
|
||||||
recordPerformance: process.env.RECORD_PERFORMANCE === 'true' || false,
|
recordPerformance: process.env.RECORD_PERFORMANCE === 'true' || false,
|
||||||
skipSanityCheck: process.env.SKIP_SANITY_CHECK === 'true' || false,
|
skipSanityCheck: process.env.SKIP_SANITY_CHECK === 'true' || false,
|
||||||
|
disableExternalPayments: process.env.DISABLE_EXTERNAL_PAYMENTS === 'true' || false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -149,6 +149,9 @@ export default class {
|
||||||
const internalInvoice = await this.storage.paymentStorage.GetInvoiceOwner(req.invoice)
|
const internalInvoice = await this.storage.paymentStorage.GetInvoiceOwner(req.invoice)
|
||||||
let payment: PaidInvoice | null = null
|
let payment: PaidInvoice | null = null
|
||||||
if (!internalInvoice) {
|
if (!internalInvoice) {
|
||||||
|
if (this.settings.disableExternalPayments) {
|
||||||
|
throw new Error("something went wrong sending payment, please try again later")
|
||||||
|
}
|
||||||
this.log("paying external invoice", req.invoice)
|
this.log("paying external invoice", req.invoice)
|
||||||
const routingFeeLimit = this.lnd.GetFeeLimitAmount(payAmount)
|
const routingFeeLimit = this.lnd.GetFeeLimitAmount(payAmount)
|
||||||
await this.storage.userStorage.DecrementUserBalance(userId, totalAmountToDecrement + routingFeeLimit, req.invoice)
|
await this.storage.userStorage.DecrementUserBalance(userId, totalAmountToDecrement + routingFeeLimit, req.invoice)
|
||||||
|
|
|
||||||
|
|
@ -16,5 +16,6 @@ export type MainSettings = {
|
||||||
servicePort: number
|
servicePort: number
|
||||||
recordPerformance: boolean
|
recordPerformance: boolean
|
||||||
skipSanityCheck: boolean
|
skipSanityCheck: boolean
|
||||||
|
disableExternalPayments: boolean
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue