"""Настройки парсинга IVK (pre-prod)."""
from __future__ import annotations
import json
from pathlib import Path

_DEFAULT_BASE_URL = "https://pre-prod.ivk-group.ru"
_SECRETS_PATH = Path(__file__).with_name("secrets.json")

BASE_URL = _DEFAULT_BASE_URL
HTTP_AUTH: tuple[str, str] | None = None
PER_PAGE = 30

if _SECRETS_PATH.is_file():
    data = json.loads(_SECRETS_PATH.read_text(encoding="utf-8"))
    BASE_URL = data.get("base_url", BASE_URL)
    user = data.get("http_user")
    password = data.get("http_password")
    if user and password:
        HTTP_AUTH = (user, password)
