Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions dashboard/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,6 @@ FROM node:20-alpine AS builder

WORKDIR /app

# Build-time public vars for Next.js client bundle
ARG NEXT_PUBLIC_API_URL=http://localhost:8080
ARG NEXT_PUBLIC_API_KEY=
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
ENV NEXT_PUBLIC_API_KEY=${NEXT_PUBLIC_API_KEY}

# Install dependencies
COPY package*.json ./
RUN npm install
Expand All @@ -24,11 +18,6 @@ FROM node:20-alpine AS production

WORKDIR /app

ARG NEXT_PUBLIC_API_URL=http://localhost:8080
ARG NEXT_PUBLIC_API_KEY=
ENV NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL}
ENV NEXT_PUBLIC_API_KEY=${NEXT_PUBLIC_API_KEY}

# Install only production dependencies
COPY --from=builder /app/package.json ./package.json
COPY --from=builder /app/package-lock.json ./package-lock.json
Expand Down
2 changes: 1 addition & 1 deletion dashboard/lib/project-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export function ProjectProvider({ children }: { children: React.ReactNode }) {
const fetchProjects = async () => {
setIsLoading(true)
try {
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8080'
const API_BASE_URL = process.env.NEXT_PUBLIC_API_URL || '/api/openmemory'
const res = await fetch(`${API_BASE_URL}/dashboard/projects`)
if (res.ok) {
const data = await res.json()
Expand Down
18 changes: 18 additions & 0 deletions dashboard/tests/auth-config.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const test = require('node:test')
const assert = require('node:assert/strict')
const fs = require('node:fs')
const path = require('node:path')

const root = path.resolve(__dirname, '..', '..')
const read = (relativePath) => fs.readFileSync(path.resolve(root, relativePath), 'utf8')

test('dashboard falls back to the server proxy without baking public API config', () => {
const context = read('dashboard/lib/project-context.tsx')
const proxy = read('dashboard/app/api/openmemory/[...path]/route.ts')
const dockerfile = read('dashboard/Dockerfile')

assert.match(context, /process\.env\.NEXT_PUBLIC_API_URL \|\| '\/api\/openmemory'/)
assert.match(proxy, /process\.env\.OPENMEMORY_API_URL \|\| 'http:\/\/127\.0\.0\.1:7331'/)
assert.doesNotMatch(dockerfile, /NEXT_PUBLIC_API_URL/)
assert.doesNotMatch(dockerfile, /NEXT_PUBLIC_API_KEY/)
})