docs/configuration.md
All configuration lives in SourceMonitor.configure—the install generator creates config/initializers/source_monitor.rb with sensible defaults and inline documentation. This guide expands on every namespace so you know which knobs to turn in production.
SourceMonitor.configure do |config|
# customize settings here
end
Restart your application whenever you change these settings. The engine reloads model extensions automatically when the block runs, but background processes need a restart to pick up queue name or adapter changes.
cssbundling-rails and jsbundling-rails; follow .ai/engine-asset-configuration.md:11-113 when adjusting dependency versions or adding new entrypoints.app/assets/builds/source_monitor, images/source_monitor, svgs/source_monitor) so host apps avoid collisions. See .ai/engine-asset-configuration.md:32-44 for the layout recommendations.rbenv exec bundle exec rake app:source_monitor:assets:build (or npm run build) after tweaking Tailwind/Stimulus code to refresh the builds, and rely on test/dummy/bin/dev to watch build:css:watch + build:js:watch during development..ai/engine-asset-configuration.md:114-143.config.queue_namespace – prefix applied to queue names ("source_monitor" by default)config.fetch_queue_name / config.scrape_queue_name – base queue names before the host's ActiveJob.queue_name_prefix is appliedconfig.fetch_queue_concurrency / config.scrape_queue_concurrency – advisory values Solid Queue uses for per-queue limitsconfig.maintenance_queue_name – queue name for maintenance jobs ("source_monitor_maintenance" by default)config.maintenance_queue_concurrency – advisory concurrency for the maintenance queue (default 1)config.queue_name_for(:fetch | :scrape | :maintenance) – helper that respects the host's queue prefixUse the helpers exposed on SourceMonitor:
SourceMonitor.queue_name(:fetch) # => "source_monitor_fetch"
SourceMonitor.queue_name(:maintenance) # => "source_monitor_maintenance"
SourceMonitor.queue_concurrency(:scrape) # => 2
config.job_metrics_enabled – toggles Solid Queue metrics collection for the dashboard cards (default true)config.mission_control_enabled – surfaces the Mission Control link on the dashboard when trueconfig.mission_control_dashboard_path – host route helper or callable returning the Mission Control path/URL; left blank by defaultThe helper SourceMonitor.mission_control_dashboard_path performs a routing check so the dashboard only renders links that resolve.
config.http maps directly onto Faraday's middleware options.
timeout – total request timeout in seconds (default 15)open_timeout – connection open timeout in seconds (5)max_redirects – maximum redirects to follow (5)user_agent – defaults to Mozilla/5.0 (compatible; SourceMonitor/<version>) (browser-like to avoid bot-blocking)proxy – hash or URL to configure proxy usageheaders – hash (or callables) merged into every requestretry_max, retry_interval, retry_interval_randomness, retry_backoff_factor, retry_statuses – mapped to faraday-retryconfig.fetching controls adaptive scheduling.
min_interval_minutes / max_interval_minutes – enforce floor/ceiling for automatic schedule adjustments (defaults: 5 and 1440)increase_factor / decrease_factor – multipliers when a source trends slow/fastfailure_increase_factor – multiplier applied on consecutive failuresjitter_percent – random jitter applied to next fetch time (0.1 = ±10%)scheduler_batch_size – max sources picked up per scheduler run (default 25, was 100)stale_timeout_minutes – minutes before a source stuck in "fetching" is reset (default 5, was 10)config.retention sets global defaults that sources inherit when their fields are blank.
items_retention_days – prune items older than this many days (nil = retain forever)max_items – keep only the most recent N items (nil = unlimited)strategy – :destroy or :soft_delete (defaults to :destroy in the configuration class; the installer comments demonstrate :soft_delete)The retention pruner runs after every successful fetch and inside nightly cleanup jobs.
Register adapters that inherit from SourceMonitor::Scrapers::Base:
config.scrapers.register(:readability, SourceMonitor::Scrapers::Readability)
config.scrapers.register(:custom, "MyApp::Scrapers::Premium" )
Adapters receive merged settings (default -> source -> invocation), and must return a SourceMonitor::Scrapers::Result object. Use config.scrapers.unregister(:custom) to remove overrides.
config.scraping controls scrape concurrency and recommendations.
max_in_flight_per_source – max concurrent scrape jobs per source (nil = unlimited, default nil)max_bulk_batch_size – max items per bulk scrape enqueue (default 100)scrape_recommendation_threshold – minimum average feed word count below which a source is recommended for scraping (default 200)Respond to lifecycle events without monkey patching:
config.events.after_item_created do |event|
Analytics.track_new_item(event.item, source: event.source)
end
config.events.after_fetch_completed do |event|
Rails.logger.info("Feed #{event.source.name} finished with #{event.status}")
end
config.events.register_item_processor ->(context) {
SearchIndexer.index(context.item)
}
Event structs expose item, source, entry, result, status, and occurred_at. Item processors run after events and receive an ItemProcessorContext with the same shape.
config.models lets host apps customise engine models at load time.
config.models.table_name_prefix – override the default sourcemon_ prefixconfig.models.source.include_concern "MyApp::SourceMonitor::SourceExtensions" – mix in concerns before models loadconfig.models.source.validate :ensure_metadata_rules – register validations (blocks or symbols)config.models.item, etc.The engine reloads model extensions whenever configuration runs so code reloading in development continues to work.
config.realtime governs Action Cable transport.
config.realtime.adapter – one of :solid_cable, :redis, or :asyncconfig.realtime.redis_url – optional Redis URL when using the Redis adapterconfig.realtime.solid_cable – yields options: polling_interval, message_retention, autotrim, use_skip_locked, trim_batch_size, connects_to (hash for multi-database setups), silence_pollingCall config.realtime.action_cable_config if you need a full hash for environment-specific cable.yml generation.
Protect the dashboard with host-specific auth in one place:
config.authentication.authenticate_with :authenticate_admin!
config.authentication.authorize_with ->(controller) {
controller.current_user&.feature_enabled?(:source_monitor)
}
config.authentication.current_user_method = :current_user
config.authentication.user_signed_in_method = :user_signed_in?
Handlers can be symbols (invoked on the controller) or callables. Return false or raise to deny access.
config.health tunes automatic pause/resume heuristics.
window_size – number of fetch attempts to evaluate (default 20)healthy_threshold – ratio that drives the "working" badgeauto_pause_threshold / auto_resume_threshold – percentages that trigger automatic togglingauto_pause_cooldown_minutes – grace period before re-enabling a sourceSourceMonitor.configure – run-time configuration entry pointSourceMonitor.reset_configuration! – revert to defaults (useful in tests)SourceMonitor.events – direct access to the events registrySourceMonitor.queue_name(role) / SourceMonitor.queue_concurrency(role) – convenience helpersSourceMonitor::Metrics.snapshot – inspect counters/gauges (great for health checks)The engine honours several environment variables out of the box:
SOLID_QUEUE_SKIP_RECURRING – skip loading config/recurring.ymlSOLID_QUEUE_RECURRING_SCHEDULE_FILE – alternative schedule file pathSOFT_DELETE / SOURCE_IDS / SOURCE_ID – overrides for item cleanup rake tasksFETCH_LOG_DAYS / SCRAPE_LOG_DAYS – retention windows for log cleanupWINDOW_MINUTES – time window (minutes) for stagger_fetch_times rake task (default 10)SOURCE_MONITOR_FETCH_CONCURRENCY – override fetch queue concurrency in solid_queue.ymlSOURCE_MONITOR_SCRAPE_CONCURRENCY – override scrape queue concurrency in solid_queue.ymlSOURCE_MONITOR_MAINTENANCE_CONCURRENCY – override maintenance queue concurrency in solid_queue.ymlnpm run build (engine root) and bin/rails assets:precompile if you adjust engine assets per .ai/engine-asset-configuration.md:11-188.