geopython / pygeoapi

pygeoapi is a Python server implementation of the OGC API suite of standards. The project emerged as part of the next generation OGC API efforts in 2018 and provides the capability for organizations to deploy a RESTful OGC API endpoint using OpenAPI, GeoJSON, and HTML. pygeoapi is open source and released under an MIT license.
https://pygeoapi.io
MIT License
501 stars 266 forks source link

Allow Mounting Custom OpenAPI YAML file #1849

Open Youssef-Harby opened 3 hours ago

Youssef-Harby commented 3 hours ago

Is your feature request related to a problem? Please describe.

Yes, when I mount a custom openapi.yml into the geopython/pygeoapi Docker image, it gets overwritten by the entrypoint.sh script, which always generates a new openapi.yml at startup.

Describe the solution you'd like

Modify the entrypoint.sh script to check if an openapi.yml or PYGEOAPI_OPENAPI already exists before generating one. If a custom file is present, the script should skip the generation step.

Additional context

Allowing custom openapi.yml files to persist enhances flexibility. I'm willing to submit a PR with the necessary changes.

Youssef-Harby commented 2 hours ago

I made a workaround for now to make it works in the docker compose file :

  pygeoapi:
    container_name: pygeoapi
    image: geopython/pygeoapi:latest
    volumes:
      - ./pygeoapi-config.yml:/pygeoapi/local.config.yml
      - ./openapi-auth.yml:/pygeoapi/openapi.yml:ro
    ports:
      - 80
    environment:
      - SCRIPT_NAME=/api
      - PYGEOAPI_CONFIG=/pygeoapi/local.config.yml
      - PYGEOAPI_OPENAPI=/pygeoapi/openapi.yml
    depends_on:
      - redis
      - caddy
      - authelia
    networks:
      - caddy
    entrypoint: []
    command: gunicorn --workers 4 --worker-class gevent --timeout 6000 --name pygeoapi --bind 0.0.0.0:80 pygeoapi.flask_app:APP