Files
open-terminal/open_terminal/env.py
T
Timothy Jaeryang Baek 6c08563b56 refactor: read_file returns raw binary for supported types, rejects others
- Text files: return JSON with content string (unchanged)
- Supported binary types (image/* by default): return raw binary
  with proper Content-Type header
- Unsupported binary types: 415 error
- New env var OPEN_TERMINAL_BINARY_MIME_PREFIXES (comma-separated,
  default: 'image') controls which binary types are allowed
2026-02-24 18:49:47 -06:00

16 lines
496 B
Python

import os
API_KEY = os.environ.get("OPEN_TERMINAL_API_KEY", "")
LOG_DIR = os.environ.get(
"OPEN_TERMINAL_LOG_DIR",
os.path.join(os.path.expanduser("~"), ".open-terminal", "logs"),
)
# Comma-separated mime type prefixes for binary files that read_file will return
# as raw binary responses (e.g. "image,audio" or "image/png,image/jpeg").
BINARY_FILE_MIME_PREFIXES = [
p.strip()
for p in os.environ.get("OPEN_TERMINAL_BINARY_MIME_PREFIXES", "image").split(",")
if p.strip()
]