env toggle for perf
This commit is contained in:
parent
6f0700c58c
commit
873f9e81d5
5 changed files with 8 additions and 3 deletions
|
|
@ -39,3 +39,6 @@ SERVICE_URL=https://test.lightning.pub
|
||||||
MOCK_LND=false
|
MOCK_LND=false
|
||||||
ALLOW_BALANCE_MIGRATION=false
|
ALLOW_BALANCE_MIGRATION=false
|
||||||
MIGRATE_DB=false
|
MIGRATE_DB=false
|
||||||
|
|
||||||
|
#METRICS
|
||||||
|
RECORD_PERFORMANCE=true
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ 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.settings.recordPerformance ? mainHandler.metricsManager.AddMetrics(metrics) : null,
|
||||||
allowCors: true
|
allowCors: true
|
||||||
//throwErrors: true
|
//throwErrors: true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ export default (serverMethods: Types.ServerMethods, mainHandler: Main, nostrSett
|
||||||
let nostrUser = await mainHandler.storage.applicationStorage.GetOrCreateNostrAppUser(app, pub || "")
|
let nostrUser = await mainHandler.storage.applicationStorage.GetOrCreateNostrAppUser(app, pub || "")
|
||||||
return { user_id: nostrUser.user.user_id, app_user_id: nostrUser.identifier, app_id: appId || "" }
|
return { user_id: nostrUser.user.user_id, app_user_id: nostrUser.identifier, app_id: appId || "" }
|
||||||
},
|
},
|
||||||
metricsCallback: metrics => mainHandler.metricsManager.AddMetrics(metrics)
|
metricsCallback: metrics => mainHandler.settings.recordPerformance ? mainHandler.metricsManager.AddMetrics(metrics) : null
|
||||||
})
|
})
|
||||||
const nostr = new Nostr(nostrSettings, event => {
|
const nostr = new Nostr(nostrSettings, event => {
|
||||||
let j: NostrRequest
|
let j: NostrRequest
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ export const LoadMainSettingsFromEnv = (test = false): MainSettings => {
|
||||||
userToUserFee: EnvMustBeInteger("TX_FEE_INTERNAL_USER_BPS") / 10000,
|
userToUserFee: EnvMustBeInteger("TX_FEE_INTERNAL_USER_BPS") / 10000,
|
||||||
appToUserFee: EnvMustBeInteger("TX_FEE_INTERNAL_ROOT_BPS") / 10000,
|
appToUserFee: EnvMustBeInteger("TX_FEE_INTERNAL_ROOT_BPS") / 10000,
|
||||||
serviceUrl: EnvMustBeNonEmptyString("SERVICE_URL"),
|
serviceUrl: EnvMustBeNonEmptyString("SERVICE_URL"),
|
||||||
servicePort: EnvMustBeInteger("PORT")
|
servicePort: EnvMustBeInteger("PORT"),
|
||||||
|
recordPerformance: process.env.RECORD_PERFORMANCE === 'true' || false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,5 +14,6 @@ export type MainSettings = {
|
||||||
appToUserFee: number
|
appToUserFee: number
|
||||||
serviceUrl: string
|
serviceUrl: string
|
||||||
servicePort: number
|
servicePort: number
|
||||||
|
recordPerformance: boolean
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue