tdfs4ds.serve.sessions¶
tdfs4ds.serve.sessions
¶
Time-boxed Connect-page sessions for the admin app (0.3.7.10).
The app has no login: it uses one database identity. When that identity is typed on the Connect page, two optional limits (minutes, read at each use) bound how long it lives:
TDFS4DS_SERVE_SESSION_TTL: inactivity. A user request restarts the clock; the status poll, static files,/healthand the documentation do not.TDFS4DS_SERVE_SESSION_MAX: absolute lifetime since the Connect, activity or not.
On expiry the TDFS4DS_TD_* values the form set are forgotten (the values that were in
the environment before the form are put back), teradataml's context is closed, the app is
marked disconnected with the reason, and the health monitor stops probing. Connect again to
continue. Neither variable set = nothing here does anything. An app started with operator
credentials and never connected through the form is not expired: use a JWT token there.
TDFS4DS_SERVE_CONNECT_PAGE=off refuses the Connect page and POST /ui/connect.
Nothing in this module returns or logs a credential value.
CONNECT_PAGE_OFF_MESSAGE
module-attribute
¶
CONNECT_PAGE_OFF_MESSAGE = 'The Connect page is switched off on this server (TDFS4DS_SERVE_CONNECT_PAGE=off): the connection is set by the operator and cannot be changed from the app.'
IGNORED
module-attribute
¶
IGNORED = ('/ui/status', '/health', '/ui/static', '/static', '/documentation', '/docs', '/openapi.json', '/favicon.ico')
SessionClock
¶
Started-at / last-activity bookkeeping for ONE session, with an inactivity limit and
an absolute limit (seconds, None = no limit). Pure: the clock is time.monotonic.
The Connect-page session below is one instance; a login gate can keep one per cookie
session and reuse touch / remaining / due unchanged.
recording
¶
Within this block, env changes made through :func:set_env / :func:pop_env are
remembered so that expiry can undo them. Used by the Connect page only.
is_activity_path
¶
A request that shows someone is using the app. The status poll, static files,
/health and the documentation do not (they would keep a forgotten tab alive).
remaining
¶
Seconds left on each limit, or None when no session is under limits.
check
¶
Expire the session if a limit has run out. True when it expired now.
A background job (an index build, a rebuild) counts as activity for the inactivity limit, not for the maximum.
expire
¶
Forget the form's credentials, disconnect, record the reason.