- 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
22 lines
621 B
JavaScript
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 };
|