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:
Krystie
2026-03-29 19:39:17 -07:00
parent 6c3d2baede
commit 173dafa2f3
5 changed files with 755 additions and 0 deletions

View 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 };