Skip to content

Commit 3ebdd99

Browse files
authored
Merge pull request #23 from nullure/main
Fix api auth bug
2 parents d705bb1 + b5f8d8f commit 3ebdd99

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

backend/src/config/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const bool = (v: string | undefined) => v === 'true'
1010
export const env = {
1111
port: num(process.env.OM_PORT, 8080),
1212
db_path: str(process.env.OM_DB_PATH, './data/openmemory.sqlite'),
13-
api_key: '',
13+
api_key: process.env.OM_API_KEY
1414
emb_kind: str(process.env.OM_EMBEDDINGS, 'synthetic'),
1515
embed_mode: str(process.env.OM_EMBED_MODE, 'simple'),
1616
adv_embed_parallel: bool(process.env.OM_ADV_EMBED_PARALLEL),

backend/src/server/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ app.use((req: any, res: any, next: any) => {
1919
})
2020

2121
app.use((req: any, res: any, next: any) => {
22-
if (!env.OM_API_KEY) return next()
22+
if (!env.api_key) return next()
2323
const h = req.headers['authorization'] || ''
24-
if (!h.startsWith('Bearer ') || h.slice(7) !== env.OM_API_KEY) {
24+
if (!h.startsWith('Bearer ') || h.slice(7) !== env.api_key) {
2525
return res.status(401).json({ err: 'auth' })
2626
}
2727
next()

0 commit comments

Comments
 (0)