diff --git a/Dockerfile b/Dockerfile index 8d4327b..b03cca5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/src/linkchecker.py b/src/linkchecker.py index a914a88..a491be6 100644 --- a/src/linkchecker.py +++ b/src/linkchecker.py @@ -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 @@ -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)] @@ -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' ]