refactor: ♻️ Don't use Bun global

This commit is contained in:
Jesse Wierzbinski 2025-03-30 23:06:34 +02:00
parent d55668d529
commit 25ea870f71
No known key found for this signature in database
15 changed files with 32 additions and 19 deletions

View file

@ -3,6 +3,7 @@ import type { RolePermission } from "@versia/client/schemas";
import { Application, Emoji, Note, Token, User, db } from "@versia/kit/db";
import { Challenges } from "@versia/kit/tables";
import { extractParams, verifySolution } from "altcha-lib";
import { SHA256 } from "bun";
import chalk from "chalk";
import { type SQL, eq } from "drizzle-orm";
import type { Context, Hono, MiddlewareHandler } from "hono";
@ -525,7 +526,7 @@ export const debugRequest = async (req: Request): Promise<void> => {
const urlAndMethod = `${chalk.green(req.method)} ${chalk.blue(req.url)}`;
const hash = `${chalk.bold("Hash")}: ${chalk.yellow(
new Bun.SHA256().update(body).digest("hex"),
new SHA256().update(body).digest("hex"),
)}`;
const headers = `${chalk.bold("Headers")}:\n${Array.from(

View file

@ -1,4 +1,5 @@
import * as Sentry from "@sentry/bun";
import { env } from "bun";
import { config } from "~/config.ts";
import pkg from "~/package.json";
@ -13,8 +14,8 @@ const sentryInstance =
environment: config.logging.sentry.environment,
tracePropagationTargets:
config.logging.sentry.trace_propagation_targets,
release: Bun.env.GIT_COMMIT
? `${pkg.version}-${Bun.env.GIT_COMMIT}`
release: env.GIT_COMMIT
? `${pkg.version}-${env.GIT_COMMIT}`
: pkg.version,
integrations: [Sentry.extraErrorDataIntegration()],
});

View file

@ -1,4 +1,4 @@
import type { Server } from "bun";
import { type Server, serve } from "bun";
import type { Hono } from "hono";
import type { z } from "zod";
import type { ConfigSchema } from "~/classes/config/schema.ts";
@ -9,7 +9,7 @@ export const createServer = (
config: z.infer<typeof ConfigSchema>,
app: Hono<HonoEnv>,
): Server =>
Bun.serve({
serve({
port: config.http.bind_port,
reusePort: true,
tls: config.http.tls