Skip to content

Commit

Permalink
add option to override rootpath, if api is deployed on path
Browse files Browse the repository at this point in the history
also option to set analysed enpoint as env var
  • Loading branch information
pvgenuchten committed Jun 14, 2024
1 parent 197a91b commit 7c2dc12
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ RUN apt-get update && apt-get install --yes \

RUN adduser --uid 1000 --gecos '' --disabled-password linky

ENV OGCAPI_URL=http://localhost
ENV OGCAPI_COLLECTION=metadata:main
ENV ROOTPATH=/
ENV POSTGRES_HOST=host.docker.internal
ENV POSTGRES_PORT=5432
ENV POSTGRES_DB=postgres
Expand Down
9 changes: 5 additions & 4 deletions src/linkchecker.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@

# base catalog

base = "https://soilwise-he.containers.wur.nl/cat/"
base = os.environ.get("OGCAPI_URL") or "https://demo.pycsw.org/gisdata"
collection = os.environ.get("OGCAPI_COLLECTION") or "metadata:main"

# Remove comment'
catalogue_json_url = base + "collections/metadata:main/items?f=json"
catalogue_json_url = base + "collections/" + collection + "/items?f=json"

def setup_database():
# Connect to the database
Expand Down Expand Up @@ -132,7 +133,7 @@ def main():
total_pages, numbers_returned = get_pagination_info(catalogue_json_url)

# Base URL
base_url = base + 'collections/metadata:main/items?offset='
base_url = base + 'collections/' + collection + '/items?offset='

# Generate URLs for each page
urls = [base_url + str(i * numbers_returned) + "&f=html" for i in range(total_pages)]
Expand All @@ -146,7 +147,7 @@ def main():

# Define the formats to be removed
formats_to_remove = [
'collections/metadata:main/items?offset',
'collections/' + collection + '/items?offset',
'?f=json'
]

Expand Down

0 comments on commit 7c2dc12

Please sign in to comment.