Files
ai-news-writer/.env.example
T
Xika (Agent)andPaperclip d3f5a94ace docs(http-retry): phases 5-7 complete — docs, deprecation warnings, observability
**Phase 5: Documentation Updates**
- Update .env.example with unified HTTP_* vars and deprecation notice
- Update README.md environment vars table (mark legacy vars deprecated)
- Update textual references in README to new unified configuration

**Phase 6: Deprecation Warnings**
- Add deprecationWarningFor() helper in HttpRetryConfig
- Log warnings when legacy component-specific env vars are used
- Provide migration path in warning messages

**Phase 7: Observability**
- Add toObservability() method to expose config state for metrics
- Enable debugging of which env vars took precedence
- Add 3 new unit tests for observability functionality

All 35 HttpRetryConfig tests passing, 213 total tests passing.

Paperclip-Issue: BIT-4296
Co-Authored-By: Paperclip <[email protected]>
2026-04-18 00:22:43 +00:00

82 lines
3.5 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# AI Engine
OPENAI_API_KEY=
# Use "openai" (default), "anthropic", or "local"
AI_PROVIDER=openai
AI_MODEL=gpt-4o
OPENAI_MAX_ATTEMPTS=3
OPENAI_RETRY_BASE_MS=800
# Anthropic (optional alternative)
ANTHROPIC_API_KEY=
# WordPress target (default site — override per-site in config/sites/)
WP_URL=https://wp.newsproject.bitreport.pt
WP_USER=
WP_PASSWORD=
# rest (default) | xmlrpc — per-site override: wp_transport in config/sites/*.json
WP_TRANSPORT=rest
# Social / X (Twitter) listening (optional)
TWITTER_BEARER_TOKEN=
# Telegram listening (optional)
TELEGRAM_BOT_TOKEN=
# HTTP Retry Configuration (consolidated across all HTTP clients)
# Unified vars (recommended — set once for all clients):
HTTP_MAX_ATTEMPTS=3 # Max retry attempts (1–10, default: 3)
HTTP_RETRY_BASE_MS=500 # Base exponential backoff delay in ms (100–120000, default: 500)
HTTP_RETRY_MAX_MS=60000 # Max delay cap for exponential backoff (100–600000, default: 60000)
# Legacy component-specific vars (deprecated — for backward compatibility only):
# Priority: HTTP_* > component-specific vars > built-in defaults
# ⚠️ Deprecation notice: Use HTTP_* vars above instead. Component-specific vars will be removed in v1.0.
# - RSS_HTTP_MAX_ATTEMPTS, RSS_RETRY_BASE_MS (RSS crawler)
# - X_HTTP_MAX_ATTEMPTS, X_RETRY_BASE_MS (X/Twitter API client)
# - WP_HTTP_MAX_ATTEMPTS, WP_RETRY_BASE_MS (WordPress REST + XML-RPC publisher)
# - SCRAPER_HTTP_MAX_ATTEMPTS, SCRAPER_RETRY_BASE_MS (article scraper)
# HTTP client tuning (RSS + article scraper)
HTTP_USER_AGENT=ai-news-writer/0.1 (+https://bitreport.pt)
RSS_TIMEOUT_MS=10000
RSS_FETCH_CONCURRENCY=3
SCRAPER_TIMEOUT_MS=12000
# App — HTTP status (listen/auto mode only; bind all interfaces for NPM → LXC)
HOST=0.0.0.0
PORT=3200
# Optional: set at deploy (CI webhook) — surfaced in GET /health as deploy_revision
# PM2 ecosystem.config.cjs also injects DEPLOY_REVISION from `git rev-parse --short HEAD` when unset.
# DEPLOY_REVISION=
# GIT_REVISION=
# Inbound socket timeouts (ms). headers must stay above request (enforced in code if misconfigured).
HTTP_REQUEST_TIMEOUT_MS=120000
HTTP_HEADERS_TIMEOUT_MS=125000
# Max wall time to read POST body for /ui forms (application/x-www-form-urlencoded). 0 = no limit.
HTTP_BODY_READ_TIMEOUT_MS=120000
LOG_LEVEL=info
# Optional: required to save changes from /ui (sources, social, theme). Use a long random value in production.
ADMIN_TOKEN=
# auto | manual
MODE=manual
# Cron for auto mode, e.g. "*/30 * * * *" (every 30 min)
AUTO_CRON=*/30 * * * *
# JSONL article index under data/ — trim when file is large (stops unbounded disk growth)
ARTICLE_LOG_MAX_LINES=10000
ARTICLE_LOG_TRIM_AT_BYTES=2097152
# Optional override path (absolute or relative to repo root)
# ARTICLE_LOG_PATH=data/article-index.jsonl
# Optional IANA timezone for RSS cron and PUBLISH_HOURS window (e.g. Europe/Lisbon). Invalid values are ignored with a warning.
# CRON_TIMEZONE=Europe/Lisbon
# Optional: only publish to WordPress as "publish" during these local hours [start, end) in CRON_TIMEZONE; outside → draft.
# PUBLISH_HOURS=8-20
# Quality Scoring (article validation and metrics)
# Minimum quality score for auto-approval (0-100, higher = stricter)
QUALITY_MIN_SCORE=60
# Minimum article word count (penalizes very short articles)
QUALITY_MIN_WORD_COUNT=300
# Maximum acceptable readability grade level (Flesch-Kincaid, higher = harder to read)
# Grade 8 ≈ high school level; recommended for general audience
QUALITY_MAX_READABILITY_GRADE=8