mirror of
https://github.com/pockethost/pockethost.git
synced 2025-03-30 15:08:30 +00:00
chore: remove PbClient logger context
This commit is contained in:
parent
39a45b0aec
commit
c2dc918ad4
@ -66,7 +66,7 @@ export const ftpService = mkSingleton((config: FtpConfig) => {
|
||||
'login',
|
||||
async ({ connection, username, password }, resolve, reject) => {
|
||||
const url = (await clientService()).client.url
|
||||
const client = createPbClient(url, _ftpServiceLogger)
|
||||
const client = createPbClient(url)
|
||||
try {
|
||||
await client.client
|
||||
.collection('users')
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { mkInstanceDataPath, PUBLIC_MOTHERSHIP_NAME } from '$constants'
|
||||
import { Logger, safeCatch } from '@pockethost/common'
|
||||
import { Logger, LoggerService, safeCatch } from '@pockethost/common'
|
||||
import { Knex } from 'knex'
|
||||
import { default as PocketBase, default as pocketbaseEs } from 'pocketbase'
|
||||
import { createInstanceMixin } from './InstanceMIxin'
|
||||
@ -11,8 +11,8 @@ export type PocketbaseClientApi = ReturnType<typeof createPbClient>
|
||||
|
||||
export type MixinContext = { client: pocketbaseEs; rawDb: Knex; logger: Logger }
|
||||
|
||||
export const createPbClient = (url: string, logger: Logger) => {
|
||||
const _clientLogger = logger.create('PbClient')
|
||||
export const createPbClient = (url: string) => {
|
||||
const _clientLogger = LoggerService().create('PbClient')
|
||||
const { info } = _clientLogger
|
||||
|
||||
info(`Initializing client: ${url}`)
|
||||
|
@ -11,7 +11,7 @@ export const clientService = mkSingleton(async (cfg: ClientServiceConfig) => {
|
||||
const { url, username, password } = cfg
|
||||
const _clientLogger = LoggerService().create(`client singleton`)
|
||||
const { dbg, error } = _clientLogger
|
||||
const client = createPbClient(url, _clientLogger)
|
||||
const client = createPbClient(url)
|
||||
|
||||
try {
|
||||
await client.adminAuthViaEmail(username, password)
|
||||
@ -25,7 +25,7 @@ export const clientService = mkSingleton(async (cfg: ClientServiceConfig) => {
|
||||
dbg(`Logged in`)
|
||||
} catch (e) {
|
||||
error(`CANNOT AUTHENTICATE TO ${url}`)
|
||||
process.exit(-1)
|
||||
throw e
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user