feat(config): make ArcGIS data source URLs configurable

- Add ARCGIS_CABLE_URL, ARCGIS_LANDING_POINT_URL, ARCGIS_CABLE_LANDING_RELATION_URL to config
- Use @property to read URL from settings in collectors
- URLs can now be configured via environment variables
This commit is contained in:
rayd1o
2026-03-12 17:08:18 +08:00
parent 14d11cd99d
commit 99771a88c5
4 changed files with 19 additions and 16 deletions

View File

@@ -1,7 +1,9 @@
from typing import Dict, Any, List
from datetime import datetime
import httpx
from app.services.collectors.base import BaseCollector
from app.core.config import settings
class ArcGISCableLandingRelationCollector(BaseCollector):
@@ -11,11 +13,11 @@ class ArcGISCableLandingRelationCollector(BaseCollector):
frequency_hours = 168
data_type = "cable_landing_relation"
base_url = "https://services.arcgis.com/6DIQcwlPy8knb6sg/arcgis/rest/services/SubmarineCables/FeatureServer/3/query"
@property
def base_url(self) -> str:
return settings.ARCGIS_CABLE_LANDING_RELATION_URL
async def fetch(self) -> List[Dict[str, Any]]:
import httpx
params = {"where": "1=1", "outFields": "*", "returnGeometry": "true", "f": "geojson"}
async with httpx.AsyncClient(timeout=60.0) as client: