diff --git a/src/index.ts b/src/index.ts index b34f8e30..36ce2853 100644 --- a/src/index.ts +++ b/src/index.ts @@ -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() diff --git a/src/services/main/index.ts b/src/services/main/index.ts index 1aaf8603..08907c7e 100644 --- a/src/services/main/index.ts +++ b/src/services/main/index.ts @@ -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") } } diff --git a/src/services/main/settings.ts b/src/services/main/settings.ts index b1e9ebb8..c8532cd7 100644 --- a/src/services/main/settings.ts +++ b/src/services/main/settings.ts @@ -10,5 +10,6 @@ export type MainSettings = { outgoingInvoiceFee: number userToUserFee: number serviceUrl: string + servicePort: number } \ No newline at end of file