diff --git a/apps/api/lib/user.ts b/apps/api/lib/user.ts index 4e74d85..cb0b31f 100644 --- a/apps/api/lib/user.ts +++ b/apps/api/lib/user.ts @@ -3,20 +3,28 @@ import { db, users } from '@baseline/db'; import { eq } from 'drizzle-orm'; export async function getCurrentUserId(): Promise { - // Try real auth session first const session = await auth(); if (session?.user?.id) { return session.user.id; } - // Dev fallback: use seed user - if (process.env.NODE_ENV === 'development') { + if ( + process.env.NODE_ENV === 'development' && + process.env.BASELINE_DEV_AUTO_LOGIN === 'true' && + process.env.DATABASE_URL?.includes('localhost') + ) { const [user] = await db .select({ id: users.id }) .from(users) .where(eq(users.email, 'dev@baseline.local')) .limit(1); - if (user) return user.id; + if (user) { + console.warn( + '[auth] ⚠️ dev auto-login active — request resolved to dev@baseline.local. ' + + 'Unset BASELINE_DEV_AUTO_LOGIN to disable.', + ); + return user.id; + } } throw new Error('Unauthorized'); diff --git a/apps/marketing/Dockerfile b/apps/marketing/Dockerfile index ca2e62b..4823770 100644 --- a/apps/marketing/Dockerfile +++ b/apps/marketing/Dockerfile @@ -17,6 +17,8 @@ COPY --from=deps /app/ ./ COPY apps/marketing ./apps/marketing COPY pnpm-workspace.yaml package.json turbo.json tsconfig.base.json ./ +ARG NEXT_PUBLIC_GITHUB_USERNAME +ENV NEXT_PUBLIC_GITHUB_USERNAME=${NEXT_PUBLIC_GITHUB_USERNAME} ENV NEXT_TELEMETRY_DISABLED=1 ENV NODE_ENV=production diff --git a/apps/web/middleware.ts b/apps/web/middleware.ts deleted file mode 100644 index 91427da..0000000 --- a/apps/web/middleware.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { NextResponse } from 'next/server'; -import type { NextRequest } from 'next/server'; - -const publicPaths = ['/sign-in', '/sign-up']; - -export function middleware(request: NextRequest) { - const { pathname } = request.nextUrl; - - if (publicPaths.some((p) => pathname.startsWith(p))) { - return NextResponse.next(); - } - - const hasSession = request.cookies.get('baseline-session')?.value; - - if (!hasSession) { - return NextResponse.redirect(new URL('/sign-in', request.url)); - } - - return NextResponse.next(); -} - -export const config = { - matcher: ['/((?!_next/static|_next/image|favicon.ico).*)'], -}; diff --git a/apps/web/src/app/components/sidebar.tsx b/apps/web/src/app/components/sidebar.tsx index 7af2969..cf0e239 100644 --- a/apps/web/src/app/components/sidebar.tsx +++ b/apps/web/src/app/components/sidebar.tsx @@ -45,10 +45,18 @@ export function Sidebar() {