This commit is contained in:
boufni95 2023-12-20 18:40:27 +01:00
parent 1b4aaba566
commit 93b75904d5
4 changed files with 22 additions and 5 deletions

View file

@ -10,7 +10,8 @@ const serverOptions = (mainHandler: Main): ServerOptions => {
AppAuthGuard: async (authHeader) => { return { app_id: mainHandler.applicationManager.DecodeAppToken(stripBearer(authHeader)) } }, AppAuthGuard: async (authHeader) => { return { app_id: mainHandler.applicationManager.DecodeAppToken(stripBearer(authHeader)) } },
UserAuthGuard: async (authHeader) => { return mainHandler.appUserManager.DecodeUserToken(stripBearer(authHeader)) }, UserAuthGuard: async (authHeader) => { return mainHandler.appUserManager.DecodeUserToken(stripBearer(authHeader)) },
GuestAuthGuard: async (_) => ({}), GuestAuthGuard: async (_) => ({}),
metricsCallback: metrics => mainHandler.metricsManager.AddMetrics(metrics) metricsCallback: metrics => mainHandler.metricsManager.AddMetrics(metrics),
staticFiles: "static"
//throwErrors: true //throwErrors: true
} }
} }

View file

@ -3,13 +3,15 @@ import NewServer from '../proto/autogenerated/ts/express_server.js'
import GetServerMethods from './services/serverMethods/index.js' import GetServerMethods from './services/serverMethods/index.js'
import serverOptions from './auth.js'; import serverOptions from './auth.js';
import Main, { LoadMainSettingsFromEnv } from './services/main/index.js' import Main, { LoadMainSettingsFromEnv } from './services/main/index.js'
import Storage from './services/storage/index.js'
import { LoadNosrtSettingsFromEnv } from './services/nostr/index.js' import { LoadNosrtSettingsFromEnv } from './services/nostr/index.js'
import nostrMiddleware from './nostrMiddleware.js' import nostrMiddleware from './nostrMiddleware.js'
const start = async () => { const start = async () => {
const mainSettings = LoadMainSettingsFromEnv() const mainSettings = LoadMainSettingsFromEnv()
const mainHandler = new Main(mainSettings) const storageManager = new Storage(mainSettings.storageSettings)
await mainHandler.storage.Connect() await storageManager.Connect()
const mainHandler = new Main(mainSettings, storageManager)
await mainHandler.lnd.Warmup() await mainHandler.lnd.Warmup()
const serverMethods = GetServerMethods(mainHandler) const serverMethods = GetServerMethods(mainHandler)
const nostrSettings = LoadNosrtSettingsFromEnv() const nostrSettings = LoadNosrtSettingsFromEnv()

View file

@ -55,9 +55,9 @@ export default class {
metricsManager: MetricsManager metricsManager: MetricsManager
nostrSend: NostrSend = () => { getLogger({})("nostr send not initialized yet") } nostrSend: NostrSend = () => { getLogger({})("nostr send not initialized yet") }
constructor(settings: MainSettings) { constructor(settings: MainSettings, storage: Storage) {
this.settings = settings this.settings = settings
this.storage = new Storage(settings.storageSettings) this.storage = storage
this.metricsManager = new MetricsManager(this.storage) this.metricsManager = new MetricsManager(this.storage)
this.lnd = NewLightningHandler(settings.lndSettings, this.addressPaidCb, this.invoicePaidCb, this.newBlockCb, this.metricsManager.HtlcCb) this.lnd = NewLightningHandler(settings.lndSettings, this.addressPaidCb, this.invoicePaidCb, this.newBlockCb, this.metricsManager.HtlcCb)

14
static/index.html Normal file
View file

@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
PUB
</body>
</html>