remove unwanted log

This commit is contained in:
SrGooglo 2025-02-11 22:34:20 +00:00
parent d69579c9fd
commit 1cfe4f4e06

View File

@ -2,8 +2,6 @@ import { Server } from "linebridge"
import B2 from "backblaze-b2" import B2 from "backblaze-b2"
import hePkg from "hyper-express/package.json"
import DbManager from "@shared-classes/DbManager" import DbManager from "@shared-classes/DbManager"
import StorageClient from "@shared-classes/StorageClient" import StorageClient from "@shared-classes/StorageClient"
import CacheService from "@shared-classes/CacheService" import CacheService from "@shared-classes/CacheService"
@ -13,58 +11,58 @@ import LimitsClass from "@shared-classes/Limits"
import TaskQueueManager from "@shared-classes/TaskQueueManager" import TaskQueueManager from "@shared-classes/TaskQueueManager"
class API extends Server { class API extends Server {
static refName = "files" static refName = "files"
static useEngine = "hyper-express" static useEngine = "hyper-express"
static routesPath = `${__dirname}/routes` static routesPath = `${__dirname}/routes`
static listen_port = process.env.HTTP_LISTEN_PORT ?? 3002 static listen_port = process.env.HTTP_LISTEN_PORT ?? 3002
static enableWebsockets = true static enableWebsockets = true
middlewares = { middlewares = {
...SharedMiddlewares ...SharedMiddlewares,
} }
contexts = { contexts = {
db: new DbManager(), db: new DbManager(),
cache: new CacheService(), cache: new CacheService(),
storage: StorageClient(), storage: StorageClient(),
b2Storage: null, b2Storage: null,
SSEManager: new SSEManager(), SSEManager: new SSEManager(),
limits: {}, limits: {},
} }
queuesManager = new TaskQueueManager({ queuesManager = new TaskQueueManager({
workersPath: `${__dirname}/queues`, workersPath: `${__dirname}/queues`,
}) })
async onInitialize() { async onInitialize() {
console.log(`Using HyperExpress v${hePkg.version}`) global.sse = this.contexts.SSEManager
global.sse = this.contexts.SSEManager if (process.env.B2_KEY_ID && process.env.B2_APP_KEY) {
this.contexts.b2Storage = new B2({
applicationKeyId: process.env.B2_KEY_ID,
applicationKey: process.env.B2_APP_KEY,
})
if (process.env.B2_KEY_ID && process.env.B2_APP_KEY) { global.b2Storage = this.contexts.b2Storage
this.contexts.b2Storage = new B2({
applicationKeyId: process.env.B2_KEY_ID,
applicationKey: process.env.B2_APP_KEY,
})
global.b2Storage = this.contexts.b2Storage await this.contexts.b2Storage.authorize()
} else {
console.warn(
"B2 storage not configured on environment, skipping...",
)
}
await this.contexts.b2Storage.authorize() await this.queuesManager.initialize({
} else { redisOptions: this.engine.ws.redis.options,
console.warn("B2 storage not configured on environment, skipping...") })
} await this.contexts.db.initialize()
await this.contexts.storage.initialize()
await this.queuesManager.initialize({ global.storage = this.contexts.storage
redisOptions: this.engine.ws.redis.options global.queues = this.queuesManager
})
await this.contexts.db.initialize()
await this.contexts.storage.initialize()
global.storage = this.contexts.storage this.contexts.limits = await LimitsClass.get()
global.queues = this.queuesManager }
this.contexts.limits = await LimitsClass.get()
}
} }
Boot(API) Boot(API)