mirror of
https://github.com/versia-pub/server.git
synced 2026-03-13 05:49:16 +01:00
refactor: ♻️ Don't use Bun global
This commit is contained in:
parent
d55668d529
commit
25ea870f71
15 changed files with 32 additions and 19 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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()],
|
||||
});
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue