refactor(settings): unify config.py, mconfig.py, and settings.py into single PrySettings
- Merge all configuration into settings.py with PRY_* env var prefix. - Add legacy env aliases (PROXY_URL, TOR_ENABLED, MAX_RETRIES, etc.) for migration. - Load and persist runtime overrides from JSON config file (default /app/config.json). - Update scraper.py, deps.py, routers/config.py to use unified settings. - Add resolved_proxy_chain and resolved_proxy_url properties. - Replace tests/test_mconfig.py with tests/test_settings.py (9 tests). - Update .env.example with new PRY_* options. - All 500 tests pass; ruff clean.
This commit is contained in:
parent
ecb05bbf49
commit
1f9e71d294
9 changed files with 424 additions and 316 deletions
8
deps.py
8
deps.py
|
|
@ -6,8 +6,6 @@ direct access to shared state.
|
|||
|
||||
Usage:
|
||||
from deps import scraper, cache, automator, ...
|
||||
|
||||
Part of Pry — https://git.rugmunch.io/RugMunchMedia/pryscraper
|
||||
"""
|
||||
|
||||
# SPDX-License-Identifier: MIT
|
||||
|
|
@ -19,18 +17,16 @@ from automator import PryAutomator
|
|||
from cache import ResponseCache
|
||||
from extractor import SchemaExtractor
|
||||
from jobqueue import JobQueue
|
||||
from mconfig import PryConfig
|
||||
from parser import DocumentParser
|
||||
from ratelimit import RateLimiter
|
||||
from scraper import PryScraper
|
||||
|
||||
config = PryConfig()
|
||||
from settings import settings
|
||||
|
||||
scraper = PryScraper()
|
||||
automator = PryAutomator()
|
||||
parser = DocumentParser()
|
||||
extractor = SchemaExtractor()
|
||||
cache = ResponseCache(capacity=1000)
|
||||
ratelimiter = RateLimiter(default_rpm=120, burst=200)
|
||||
ratelimiter = RateLimiter(default_rpm=settings.rate_limit_rpm, burst=200)
|
||||
queue = JobQueue()
|
||||
advanced = PryAdvanced(cache=cache)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue