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
This commit is contained in:
21
dashcaddy-api/src/context/session.js
Normal file
21
dashcaddy-api/src/context/session.js
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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 };
|
||||
Reference in New Issue
Block a user