Files
jos-alves 7093619a0a
ai-news-writer-ci / test (pull_request) Failing after 20s
feat(error-hub): wire errors.bitreport.pt reporter into process diagnostics
Adds a minimal fire-and-forget client (POST /v1/ingest/events, Bearer
token) and wires it into installProcessDiagnostics() so uncaught
exceptions and unhandled rejections also reach the hub, not just the
local winston logs. No-op when ERROR_REPORTING_TOKEN is unset.

Paperclip-Issue: BIT-31162
2026-10-14 22:17:19 +01:00

116 lines
4.7 KiB
Bash
Raw Permalink 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=
# Default category ID when using env-only site config (no config/sites/*.json)
WP_CATEGORY=1
# 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
# Pipeline — max articles processed concurrently in listen/auto (memory + API pressure)
QUEUE_MAX_DEPTH=5
# Optional: persist RSS GUID dedupe store elsewhere (default: under data/)
# GUID_STORE_PATH=
# Monitoring — optional webhook when pipeline stages fail (Slack-compatible JSON)
# PIPELINE_ALERT_WEBHOOK_URL=
# PIPELINE_ALERT_WEBHOOK_TIMEOUT_MS=4000
# Error hub ingest (errors.bitreport.pt) — vault only; leave empty in Git examples
# ERROR_REPORTING_ENDPOINT=https://errors.bitreport.pt
# ERROR_REPORTING_TOKEN=
ERROR_REPORTING_PROJECT_SLUG=ai-news-writer
ERROR_REPORTING_GITEA_REPO=BitReport.pt/ai-news-writer
# Writing style — optional overrides (defaults come from config/writing-style.example.json)
# WRITING_STYLE_CONFIG_PATH=
# WRITING_TONE=
# AUDIENCE_LEVEL=
# Analytics DB (optional — module loads only when used)
# ANALYTICS_DB_HOST=localhost
# ANALYTICS_DB_PORT=5432
# ANALYTICS_DB_NAME=ai_news_analytics
# ANALYTICS_DB_USER=postgres
# ANALYTICS_DB_PASSWORD=
# ANALYTICS_DB_POOL_SIZE=10
# ANALYTICS_ENGAGEMENT_RETENTION_DAYS=
# ANALYTICS_DAILY_METRICS_RETENTION_DAYS=
# ANALYTICS_BENCHMARKS_RETENTION_DAYS=
# 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