Skip to content

Commit

Permalink
fix: set underpass api url via env var
Browse files Browse the repository at this point in the history
  • Loading branch information
spwoodcock committed Sep 11, 2023
1 parent 9c6229c commit fa0406a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/backend/app/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def assemble_db_connection(cls, v: Optional[str], info: FieldValidationInfo) ->
OSM_SCOPE: str = "read_prefs"
OSM_LOGIN_REDIRECT_URI: str = "http://127.0.0.1:8080/osmauth/"

UNDERPASS_API_URL: str = "https://raw-data-api0.hotosm.org/v1"
SENTRY_DSN: Optional[str] = None

model_config = SettingsConfigDict(
Expand Down
6 changes: 3 additions & 3 deletions src/backend/app/projects/project_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ def get_osm_extracts(boundary: str):
else:
query["geometry"] = json_boundary

base_url = "https://raw-data-api0.hotosm.org/v1"
base_url = settings.UNDERPASS_API_URL
query_url = f"{base_url}/snapshot/"
headers = {"accept": "application/json", "Content-Type": "application/json"}

Expand Down Expand Up @@ -1394,7 +1394,7 @@ def generate_appuser_files(
project_log.info(f"Extracting Data from OSM")

# OSM Extracts for whole project
pg = PostgresClient("https://raw-data-api0.hotosm.org/v1", "underpass")
pg = PostgresClient(settings.UNDERPASS_API_URL, "underpass")
# This file will store osm extracts
outfile = f"/tmp/{prefix}_{xform_title}.geojson"

Expand Down Expand Up @@ -2019,7 +2019,7 @@ async def update_project_form(
db.commit()

# OSM Extracts for whole project
pg = PostgresClient("https://raw-data-api0.hotosm.org/v1", "underpass")
pg = PostgresClient(settings.UNDERPASS_API_URL, "underpass")
outfile = (
f"/tmp/{project_title}_{category}.geojson" # This file will store osm extracts
)
Expand Down
3 changes: 2 additions & 1 deletion src/backend/app/tasks/tasks_crud.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
from ..projects import project_crud
from ..tasks import tasks_schemas
from ..users import user_crud
from app.config import settings


async def get_task_count_in_project(db: Session, project_id: int):
Expand Down Expand Up @@ -330,7 +331,7 @@ async def update_task_files(
task_polygons = f"/tmp/{project_name}_{category}_{task_id}.geojson"

# Update data extracts in the odk central
pg = PostgresClient("https://raw-data-api0.hotosm.org/v1", "underpass")
pg = PostgresClient(settings.UNDERPASS_API_URL, "underpass")

category = "buildings"

Expand Down

0 comments on commit fa0406a

Please sign in to comment.