INNER CODE UNIT · Python
_resolve_token
iamlukethedev/Hermes3D · plugins/hermes3d-office-bridge/__init__.py:114
def _resolve_token() -> str:
"""The office backend's session token, which is a secret and lives in env.
Pin it in ``~/.hermes/.env`` as ``HERMES3D_OFFICE_TOKEN`` — an unpinned
backend mints a random one per start, which no subscriber can know.
The office backend's own token variable, ``HERMES_DASHBOARD_SESSION_TOKEN``,
deliberately is NOT the key to pin. ``.env`` loads with ``override=True``, so
pinning that name hands the same fixed token to *every* backend on the
machine — including the one the desktop app spawns, which mints a fresh
token per launch and then cannot authenticate against its own gateway. Under
a dedicated name the office backend still receives it (passed inline on the
command line) while every other backend keeps minting its own.
"""
import os
token = (os.environ.get("HERMES3D_OFFICE_TOKEN") or "").strip()
if token: