Files
canina/infra/hermes-runtime/fixture_server.py

12 lines
703 B
Python

# Disposable acceptance fixture only; not production entrypoint.
import os,tempfile,importlib.util
os.environ['HERMES_HOME']=tempfile.mkdtemp()
os.environ['HERMES_SERVE_HEADLESS']='1'
from pathlib import Path
import json
(Path(os.environ["HERMES_HOME"])/"snapshot-manifest.json").write_text(json.dumps({"schemaVersion":1,"source":"snapshot","capturedAt":"2020-01-01T00:00:00Z"}))
spec=importlib.util.spec_from_file_location('runtime_serve','/contract/serve.py');m=importlib.util.module_from_spec(spec);spec.loader.exec_module(m)
m.secret=lambda name:'isolated-test-only-'+name+'x'*32
import uvicorn
uvicorn.run(m.build_app(),host='0.0.0.0',port=9119,lifespan='off',access_log=False,log_level='warning')