29 lines
1.3 KiB
Python
29 lines
1.3 KiB
Python
"""Create ephemeral support-only home; never load Telegram memory/plugins/hooks."""
|
|
import os
|
|
import sys
|
|
sys.path[:0] = ['/opt/hermes', '/opt/hermes/.venv/lib/python3.14/site-packages', '/opt/support-chat']
|
|
from pathlib import Path
|
|
import site
|
|
site.addsitedir('/opt/hermes/.venv/lib/python3.14/site-packages')
|
|
import hermes_yaml as yaml
|
|
source = yaml.safe_load(Path('/opt/data/config.yaml').read_text())
|
|
home = Path('/run/canina-support')
|
|
home.mkdir(mode=0o700, exist_ok=True)
|
|
safe = {
|
|
'model': source.get('model', {}),
|
|
# Provider names/models are configuration; credentials remain in env.
|
|
'custom_providers': source.get('custom_providers', []),
|
|
'web': source.get('web', {}),
|
|
'memory': {'memory_enabled': False, 'user_profile_enabled': False},
|
|
'telemetry': {'shared_metrics': {'enabled': False, 'send': False}},
|
|
'agent': {'max_iterations': 2},
|
|
'compression': {'enabled': False},
|
|
}
|
|
p = home/'config.yaml'
|
|
p.write_text(yaml.safe_dump(safe)); p.chmod(0o600)
|
|
os.environ['HERMES_HOME']=str(home)
|
|
# No Telegram token, gateway API key, DB or inherited internal credentials.
|
|
for name in list(os.environ):
|
|
if any(term in name for term in ['TELEGRAM','DATABASE','ADMIN','JWT','API_SERVER_KEY']): os.environ.pop(name,None)
|
|
os.execv('/opt/hermes/.venv/bin/python',['python','/opt/support-chat/server.py'])
|