fix: default DEM URL to api.open-elevation.com

No configuration needed out of the box; --dem-url only required to
override the default with a self-hosted or alternative endpoint.
This commit is contained in:
Davide Scaini
2026-04-20 21:17:03 +02:00
parent 1940e2409b
commit 0c659db6cb
4 changed files with 8 additions and 20 deletions
+2 -5
View File
@@ -25,7 +25,7 @@ console = Console()
@click.option("--strava-client-secret", default=None, envvar="STRAVA_CLIENT_SECRET",
help="Strava API client secret. Also reads STRAVA_CLIENT_SECRET env var.")
@click.option("--dem-url", default=None, envvar="DEM_URL",
help="Base URL of an Open-Elevation-compatible API (enables 'Recalculate elevation' button).")
help="Base URL of an Open-Elevation-compatible API (default: https://api.open-elevation.com).")
def edit(
data_dir: Optional[str],
port: int,
@@ -78,10 +78,7 @@ def edit(
console.print(f"Strava sync: [green]enabled[/green] (client {strava_client_id})")
else:
console.print("Strava sync: [yellow]disabled[/yellow] (pass --strava-client-id to enable)")
if dem_url:
console.print(f"DEM: [green]enabled[/green] ({dem_url})")
else:
console.print("DEM: [yellow]disabled[/yellow] (pass --dem-url to enable elevation recalculation)")
console.print(f"DEM: [cyan]{srv.dem_url}[/cyan]")
uvicorn.run(srv.app, host="127.0.0.1", port=port, log_level="warning")
+2 -6
View File
@@ -20,7 +20,7 @@ data_dir: Path | None = None
site_url: str = "http://localhost:4321"
strava_client_id: str = ""
strava_client_secret: str = ""
dem_url: str = "" # Open-Elevation-compatible API base URL; empty = feature disabled
dem_url: str = "https://api.open-elevation.com" # Open-Elevation-compatible API base URL
# In-memory CSRF state tokens for OAuth flows (token → True); cleared after use
_oauth_states: set[str] = set()
@@ -435,11 +435,7 @@ async def recalculate_elevation_endpoint(activity_id: str) -> JSONResponse:
Requires --dem-url to be set when starting bincio edit.
"""
if not dem_url:
raise HTTPException(
503,
"DEM URL not configured. "
"Pass --dem-url <api-url> to bincio edit (e.g. https://api.open-elevation.com).",
)
raise HTTPException(503, "DEM URL not configured.")
dd = _get_data_dir()
_check_id(activity_id)
try: