change log in

This commit is contained in:
oliver 2026-09-08 00:28:58 +08:00
parent 9cf026f605
commit 8ca42dd973
211 changed files with 48417 additions and 109 deletions

View file

@ -0,0 +1,27 @@
import { MemoryStore } from './memory-store.js'
import { RedisStore } from './redis-store.js'
/**
* Factory function to create appropriate session store based on config
* @param {object} config - Session configuration
* @returns {Promise<SessionStore>}
*/
export async function createSessionStore(config) {
const { storeType, redisUrl } = config
if (storeType === 'redis') {
try {
const { createClient } = await import('redis')
const client = createClient({ url: redisUrl })
await client.connect()
return new RedisStore(client)
} catch (err) {
console.error('[uds-auth] Failed to connect to Redis:', err.message)
console.warn('[uds-auth] Falling back to MemoryStore')
return new MemoryStore()
}
}
// Default to memory store
return new MemoryStore()
}