add lightning
This commit is contained in:
parent
057bb0f10a
commit
bf73e98425
|
@ -0,0 +1,12 @@
|
|||
import lndService from 'ln-service'
|
||||
|
||||
if (!global.lnd) {
|
||||
const { lnd } = lndService.authenticatedLndGrpc({
|
||||
cert: process.env.LND_CERT,
|
||||
macaroon: process.env.LND_MACAROON,
|
||||
socket: process.env.LND_SOCKET
|
||||
})
|
||||
global.lnd = lnd
|
||||
}
|
||||
|
||||
export default global.lnd
|
|
@ -1,14 +1,7 @@
|
|||
import { PrismaClient } from '@prisma/client'
|
||||
|
||||
let prisma
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
prisma = new PrismaClient()
|
||||
} else {
|
||||
if (!global.prisma) {
|
||||
global.prisma = new PrismaClient()
|
||||
}
|
||||
prisma = global.prisma
|
||||
if (!global.prisma) {
|
||||
global.prisma = new PrismaClient()
|
||||
}
|
||||
|
||||
export default prisma
|
||||
export default global.prisma
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
"bootstrap": "^4.6.0",
|
||||
"formik": "^2.2.6",
|
||||
"graphql": "^15.5.0",
|
||||
"ln-service": "^51.7.0",
|
||||
"next": "10.0.9",
|
||||
"next-auth": "^3.13.3",
|
||||
"react": "17.0.1",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { ApolloServer } from 'apollo-server-micro'
|
||||
import resolvers from '../../api/resolvers'
|
||||
import models from '../../api/models'
|
||||
import lnd from '../../api/lnd'
|
||||
import typeDefs from '../../api/typeDefs'
|
||||
import { getSession } from 'next-auth/client'
|
||||
|
||||
|
@ -12,6 +13,7 @@ const apolloServer = new ApolloServer({
|
|||
const session = await getSession({ req })
|
||||
return {
|
||||
models,
|
||||
lnd,
|
||||
me: session ? session.user : null
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue