chore(dev): bootstrap script wires docker + drizzle push + turbo dev

This commit is contained in:
Marco Sadjadi
2026-05-19 00:35:27 +02:00
parent b07de86db6
commit 648427000d
5 changed files with 138 additions and 26 deletions

View File

@@ -46,7 +46,7 @@ async function resolveServerByResource(resource: string) {
export async function oauthRoutes(app: FastifyInstance): Promise<void> {
// Authorization Server Metadata (RFC 8414) — control-plane wide
app.get('/oauth/.well-known/oauth-authorization-server', async (_req, reply) => {
const base = `${req_base(_req as never)}`;
const base = `${reqBase(_req)}`;
return reply.send({
issuer: `${base}/oauth`,
authorization_endpoint: `${base}/oauth/authorize`,
@@ -215,7 +215,7 @@ export async function oauthRoutes(app: FastifyInstance): Promise<void> {
const accessToken = await signAccessToken({
subject: row.code.userId ?? row.client.clientId,
audience: resource,
issuer: `${req_base(req as never)}/oauth`,
issuer: `${reqBase(req)}/oauth`,
scope: row.code.scope ?? '',
ttlSeconds: 3600,
});
@@ -249,7 +249,7 @@ export async function oauthRoutes(app: FastifyInstance): Promise<void> {
if (!parsed.success) return reply.code(400).send({ error: 'invalid_request' });
const server = await resolveServerByResource(parsed.data.resource);
if (!server) return reply.code(404).send({ error: 'not_found' });
const base = req_base(req as never);
const base = reqBase(req);
return reply.send({
resource: parsed.data.resource,
authorization_servers: [`${base}/oauth`],
@@ -261,8 +261,12 @@ export async function oauthRoutes(app: FastifyInstance): Promise<void> {
void config;
}
function req_base(req: { protocol?: string; hostname?: string; headers: Record<string, string | string[] | undefined> }): string {
const host = (req.headers['x-forwarded-host'] as string) ?? req.headers.host ?? `localhost:${config.PORT}`;
const proto = (req.headers['x-forwarded-proto'] as string) ?? req.protocol ?? 'http';
function reqBase(req: { protocol?: string; headers: Record<string, string | string[] | undefined> }): string {
const host =
(req.headers['x-forwarded-host'] as string | undefined) ??
(req.headers.host as string | undefined) ??
`localhost:${config.PORT}`;
const proto =
(req.headers['x-forwarded-proto'] as string | undefined) ?? req.protocol ?? 'http';
return `${proto}://${host}`;
}

View File

@@ -1,6 +1,7 @@
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
transpilePackages: ['@bmm/types'],
experimental: {
typedRoutes: false,
},