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 -3
View File
@@ -21,7 +21,7 @@ console = Console()
@click.option("--max-users", default=None, type=int, help="Override max users for this instance (0 = unlimited; updates the DB setting)")
@click.option("--public-url", default=None, envvar="PUBLIC_URL", help="Public base URL (e.g. https://yourdomain.com). Required for Strava OAuth to work behind a reverse proxy.")
@click.option("--webroot", default=None, type=click.Path(), help="Nginx webroot (e.g. /var/www/bincio). When set, uploads trigger a full Astro build + rsync so new activity pages are immediately accessible without a git push.")
@click.option("--dem-url", default=None, envvar="DEM_URL", help="Base URL of an Open-Elevation-compatible API (enables 'Recalculate elevation' button in the edit drawer).")
@click.option("--dem-url", default=None, envvar="DEM_URL", help="Base URL of an Open-Elevation-compatible API (default: https://api.open-elevation.com).")
def serve(data_dir: str, site_dir: Optional[str], host: str, port: int,
strava_client_id: Optional[str], strava_client_secret: Optional[str],
max_users: Optional[int], public_url: Optional[str],
@@ -77,8 +77,7 @@ def serve(data_dir: str, site_dir: Optional[str], host: str, port: int,
console.print(f" Users: [yellow]max {current_limit}[/yellow]")
else:
console.print(f" Users: [dim]unlimited[/dim]")
if dem_url:
console.print(f" DEM: [cyan]{dem_url}[/cyan]")
console.print(f" DEM: [cyan]{srv.dem_url}[/cyan]")
console.print()
log_config = uvicorn.config.LOGGING_CONFIG.copy()
+2 -6
View File
@@ -158,7 +158,7 @@ webroot: Path | None = None # nginx webroot — when set, trigger full rebuil
strava_client_id: str = ""
strava_client_secret: str = ""
public_url: str = "" # e.g. "https://yourdomain.com" — used for OAuth redirect URIs
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
_db = None # sqlite3.Connection, opened lazily
@@ -1279,11 +1279,7 @@ async def recalculate_elevation_endpoint(
user = _require_user(bincio_session)
_check_id(activity_id)
if not dem_url:
raise HTTPException(
503,
"DEM URL not configured. "
"Pass --dem-url <api-url> to bincio serve (e.g. https://api.open-elevation.com).",
)
raise HTTPException(503, "DEM URL not configured.")
dd = _get_data_dir() / user.handle
if not (dd / "activities" / f"{activity_id}.json").exists():
raise HTTPException(404, "Activity not found")