← back to Govarbitrage
scripts/george-env.py
18 lines
#!/usr/bin/env python3
"""Print export lines for George transport creds, read at runtime from their
canonical homes (~/.claude.json, george-gmail/.env) — never duplicated to disk.
Used via: eval "$(/usr/bin/python3 scripts/george-env.py)"."""
import json, os, re, shlex
env = json.load(open(os.path.expanduser("~/.claude.json")))["mcpServers"]["george"]["env"]
print("export GEORGE_URL=" + shlex.quote(env["GEORGE_URL"]))
print("export GEORGE_BASIC_AUTH=" + shlex.quote(env["GEORGE_BASIC_AUTH"]))
tok = ""
pat = re.compile(r"GEORGE_EXTERNAL_SEND_TOKEN=[\"']?([^\"'\n]+)")
for line in open(os.path.expanduser("~/Projects/george-gmail/.env")):
m = pat.match(line)
if m:
tok = m.group(1)
print("export GEORGE_EXTERNAL_SEND_TOKEN=" + shlex.quote(tok))