"""Read ogmemory YAML config and print shell export statements.
Used by entrypoint-standalone.sh to make service.http_port and
service.workers available as OGMEM_HTTP_PORT / OGMEM_WORKERS before
gunicorn starts.
Usage (in shell):
eval $(python3 /opt/ogmem/scripts/yaml_to_env.py)
"""
import os
import sys
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
try:
from providers.unified_config import OgMemConfig
except Exception:
sys.exit(0)
try:
cfg = OgMemConfig.load()
except Exception:
sys.exit(0)
print(f'export OGMEM_HTTP_PORT="{cfg.http_port}"')
print(f'export OGMEM_WORKERS="{cfg.workers}"')