179 lines
6.7 KiB
Markdown
179 lines
6.7 KiB
Markdown
# Momentry Core Config Management
|
|
|
|
## Directory Structure
|
|
|
|
```
|
|
momentry_core_0.1/
|
|
├── .env.example # Template (version controlled)
|
|
├── .env # Local config (gitignored)
|
|
├── .env.development # Playground dev overrides (gitignored)
|
|
├── .env.local # Local overrides (gitignored)
|
|
├── config/
|
|
│ ├── README.md # This file
|
|
│ └── port_registry.tsv # Central port registry
|
|
└── src/core/config.rs # Config code with lazy_static env reading
|
|
```
|
|
|
|
## Load Order
|
|
|
|
For `momentry_playground` (development):
|
|
1. `.env` — shared defaults
|
|
2. `.env.development` — dev-specific overrides (loaded by playground binary)
|
|
|
|
For `momentry` (production):
|
|
1. `.env` — production config
|
|
|
|
In Rust: `config.rs` reads env vars with lazy_static, falling back to hardcoded defaults.
|
|
|
|
## Environment Variables
|
|
|
|
### Server
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `MOMENTRY_SERVER_PORT` | Server port (3002=prod, 3003=dev) | `3002` |
|
|
| `MOMENTRY_REDIS_PREFIX` | Redis key prefix | `momentry:` (prod), `momentry_dev:` (dev) |
|
|
|
|
### Database
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `DATABASE_URL` | PostgreSQL connection string | `postgres://accusys@localhost:5432/momentry` |
|
|
| `DATABASE_SCHEMA` | Schema for dev isolation | `dev` |
|
|
| `MONGODB_URL` | MongoDB connection string | `mongodb://localhost:27017` |
|
|
| `MONGODB_DATABASE` | MongoDB database name | `momentry` (prod), `momentry_dev` (dev) |
|
|
| `MONGODB_CACHE_ENABLED` | MongoDB cache toggle | `true` |
|
|
| `MONGODB_CACHE_TTL_VIDEOS` | Cache TTL for videos | `300` |
|
|
| `MONGODB_CACHE_TTL_SEARCH` | Cache TTL for search | `300` |
|
|
| `MONGODB_CACHE_TTL_HYBRID_SEARCH` | Cache TTL for hybrid search | `600` |
|
|
| `MONGODB_CACHE_TTL_VIDEO_META` | Cache TTL for video metadata | `3600` |
|
|
|
|
### Redis
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `REDIS_URL` | Redis connection string | `redis://:accusys@localhost:6379` |
|
|
| `REDIS_PASSWORD` | Redis password | `accusys` |
|
|
| `REDIS_CACHE_TTL_HEALTH` | Health check cache TTL | `30` |
|
|
| `REDIS_CACHE_TTL_VIDEO_META` | Video metadata cache TTL | `3600` |
|
|
|
|
### Qdrant
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `QDRANT_URL` | Qdrant server URL | `http://localhost:6333` |
|
|
| `QDRANT_API_KEY` | Qdrant API key | `Test3200Test3200Test3200` |
|
|
| `QDRANT_COLLECTION` | Collection name | `momentry_rule1` (prod), `momentry_dev_rule1_v2` (dev) |
|
|
|
|
### LLM
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `MOMENTRY_LLM_CHAT_URL` | Chat/function-calling endpoint | `http://127.0.0.1:8082/v1/chat/completions` |
|
|
| `MOMENTRY_LLM_CHAT_MODEL` | Chat model name | `google_gemma-4-26B-A4B-it-Q5_K_M.gguf` |
|
|
| `MOMENTRY_LLM_VISION_URL` | Vision LLM endpoint (E4B) | falls back to CHAT_URL |
|
|
| `MOMENTRY_LLM_VISION_MODEL` | Vision model name (E4B) | falls back to CHAT_MODEL |
|
|
| `MOMENTRY_LLM_SUMMARY_URL` | Summary LLM endpoint (5W1H) | falls back to CHAT_URL |
|
|
| `MOMENTRY_LLM_SUMMARY_MODEL` | Summary model name | falls back to CHAT_MODEL |
|
|
| `MOMENTRY_LLM_SUMMARY_ENABLED` | Toggle 5W1H summary generation | `true` |
|
|
| `MOMENTRY_LLM_SUMMARY_TIMEOUT` | 5W1H timeout in seconds | `120` |
|
|
| `MOMENTRY_LLM_CHAT_TIMEOUT` | Chat LLM timeout in seconds | `120` |
|
|
| `MOMENTRY_LLM_VISION_TIMEOUT` | Vision LLM timeout in seconds | `120` |
|
|
|
|
### Embedding
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `MOMENTRY_EMBED_URL` | Embedding server URL | `http://localhost:11436` |
|
|
|
|
### TMDb Integration
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `TMDB_API_KEY` | TMDb API key (required for probe) | (none) |
|
|
| `MOMENTRY_TMDB_PROBE_ENABLED` | Enable TMDb probe during register | `false` |
|
|
|
|
### Paths
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `MOMENTRY_OUTPUT_DIR` | Output directory for processing | `/Users/accusys/momentry/output` |
|
|
| `MOMENTRY_BACKUP_DIR` | Backup directory | `/Users/accusys/momentry/backup/momentry` |
|
|
| `MOMENTRY_SCRIPTS_DIR` | Python scripts directory | `/Users/accusys/momentry_core_0.1/scripts` |
|
|
| `MOMENTRY_PYTHON_PATH` | Python interpreter path | `/opt/homebrew/bin/python3.11` |
|
|
| `MOMENTRY_MEDIA_BASE_URL` | Base URL for media serving | (none) |
|
|
|
|
### Processor Timeouts
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `MOMENTRY_ASR_TIMEOUT` | ASR timeout in seconds | `3600` |
|
|
| `MOMENTRY_CUT_TIMEOUT` | CUT timeout in seconds | `3600` |
|
|
| `MOMENTRY_DEFAULT_TIMEOUT` | Default timeout in seconds | `7200` |
|
|
|
|
### Logging
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `RUST_LOG` | Rust log level (tracing) | `info` |
|
|
| `MOMENTRY_LOG_LEVEL` | Fallback log level | `info` |
|
|
|
|
### Worker
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `MOMENTRY_WORKER_ENABLED` | Enable background worker | `true` |
|
|
| `MOMENTRY_MAX_CONCURRENT` | Max concurrent jobs | `6` |
|
|
| `MOMENTRY_POLL_INTERVAL` | Poll interval in seconds | `10` |
|
|
| `MOMENTRY_WORKER_BATCH_SIZE` | Batch size | `5` |
|
|
|
|
### Synonym Expansion
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `MOMENTRY_SYNONYM_FILES` | Comma-separated paths to synonym JSON files | (none) |
|
|
| `MOMENTRY_SYNONYM_FILE` | Single synonym file (deprecated) | (none) |
|
|
|
|
### Encryption
|
|
|
|
| Variable | Description | Default |
|
|
|----------|-------------|---------|
|
|
| `AUDIT_ENCRYPTION_KEY` | 32-byte hex encryption key (64 hex chars) | (none) |
|
|
|
|
## Port Registry
|
|
|
|
See `config/port_registry.tsv` for the authoritative list of all ports and their owners.
|
|
|
|
| Port | Service | Owner | Config Key |
|
|
|------|---------|-------|------------|
|
|
| 5432 | PostgreSQL | postgres | `DATABASE_URL` |
|
|
| 6379 | Redis | redis-server | `REDIS_URL` |
|
|
| 6333 | Qdrant | qdrant | `QDRANT_URL` |
|
|
| 8082 | LLM Chat (A4B) | llama-server | `MOMENTRY_LLM_CHAT_URL` |
|
|
| 8083 | LLM Vision (E4B) | llama-server | `MOMENTRY_LLM_VISION_URL` |
|
|
| 11434 | Ollama | ollama | `MOMENTRY_OLLAMA_URL` |
|
|
| 11436 | Embedding | embeddinggemma_server.py | `MOMENTRY_EMBED_URL` |
|
|
| 27017 | MongoDB | mongod | `MONGODB_URL` |
|
|
| 3002 | Production API | momentry | `MOMENTRY_SERVER_PORT` |
|
|
| 3003 | Playground API | momentry_playground | `MOMENTRY_SERVER_PORT` |
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# 1. Copy template
|
|
cp .env.example .env
|
|
|
|
# 2. Edit .env for production or use .env.development for playground
|
|
# 3. Start all services
|
|
./scripts/start_momentry.sh
|
|
```
|
|
|
|
## Version Control
|
|
|
|
| File | Tracked | Purpose |
|
|
|------|---------|---------|
|
|
| `.env.example` | ✅ Yes | Template with all options documented |
|
|
| `.env` | ❌ No | Local sensitive config |
|
|
| `.env.development` | ❌ No | Dev-specific overrides |
|
|
| `.env.local` | ❌ No | Local overrides (highest priority) |
|