configurable port

This commit is contained in:
hatim 2023-05-08 21:44:22 +02:00
parent 29788aac81
commit 9e51af0861
3 changed files with 6 additions and 3 deletions

View file

@ -7,13 +7,14 @@ import { LoadNosrtSettingsFromEnv } from './services/nostr/index.js'
import nostrMiddleware from './nostrMiddleware.js'
const start = async () => {
const mainHandler = new Main(LoadMainSettingsFromEnv())
const mainSettings = LoadMainSettingsFromEnv()
const mainHandler = new Main(mainSettings)
await mainHandler.storage.Connect()
await mainHandler.lnd.Warmup()
const serverMethods = GetServerMethods(mainHandler)
const nostrSettings = LoadNosrtSettingsFromEnv()
nostrMiddleware(serverMethods, mainHandler, nostrSettings)
const Server = NewServer(serverMethods, serverOptions(mainHandler))
Server.Listen(8080)
Server.Listen(mainSettings.servicePort)
}
start()

View file

@ -18,7 +18,8 @@ export const LoadMainSettingsFromEnv = (test = false): MainSettings => {
incomingInvoiceFee: EnvMustBeInteger("SERVICE_FEE_INCOMING_INVOICE_PERCENT") / 100,
outgoingInvoiceFee: EnvMustBeInteger("SERVICE_FEE_OUTGOING_INVOICE_PERCENT") / 100,
userToUserFee: EnvMustBeInteger("SERVICE_FEE_USER_TO_USER_PERCENT") / 100,
serviceUrl: EnvMustBeNonEmptyString("SERVICE_URL")
serviceUrl: EnvMustBeNonEmptyString("SERVICE_URL"),
servicePort: EnvMustBeInteger("PORT")
}
}

View file

@ -10,5 +10,6 @@ export type MainSettings = {
outgoingInvoiceFee: number
userToUserFee: number
serviceUrl: string
servicePort: number
}