Files
dashcaddy/dashcaddy-api/src/context/session.js
Krystie 173dafa2f3 refactor(context): Extract context modules from god object
- Create src/context/docker.js - Docker operations
- Create src/context/caddy.js - Caddyfile manipulation
- Create src/context/dns.js - DNS token management and API calls
- Create src/context/session.js - Session wrapper
- Create src/context/index.js - Context assembly (DI container)

Breaks up the 50+ property ctx god object into domain-specific modules
2026-03-29 19:39:17 -07:00

22 lines
621 B
JavaScript

/**
* Session context - IP-based session management
* (Implementation provided by middleware, just re-exported here)
*/
function createSessionContext(middlewareResult) {
const { ipSessions, SESSION_DURATIONS, getClientIP, createIPSession, setSessionCookie, clearIPSession, clearSessionCookie, isSessionValid } = middlewareResult;
return {
ipSessions,
durations: SESSION_DURATIONS,
getClientIP,
create: createIPSession,
setCookie: setSessionCookie,
clear: clearIPSession,
clearCookie: clearSessionCookie,
isValid: isSessionValid,
};
}
module.exports = { createSessionContext };