Skip to content
This repository has been archived by the owner on Jun 14, 2023. It is now read-only.

Latest commit

 

History

History
84 lines (61 loc) · 2.67 KB

README.md

File metadata and controls

84 lines (61 loc) · 2.67 KB

Polling Swagger-UI

A Swagger-UI which periodically polls configuration from an URL.

Build Status Image Size

Configuration

Docker Container

You must set the following environment variables to run the Docker container:

Advanced

It optionally accepts the following arguments:

  • POLL_INTERVAL_SECONDS: The refresh interval in seconds.
    • Default is 300 (5 minutes).
  • SWAGGER_ROOT: The swagger root folder, if using custom nginx configuration.
    • Default ist /usr/share/nginx/html.

The default exposed port is 8080.

Node.js

The image uses Node.js internally for polling. You can add any environment variables you like to configure the Node.js process. E.g. add custom truststore via NODE_EXTRA_CA_CERTS etc.

Swagger

Because of a known issue the swagger configuration currently has to be in json-format. yaml does not work. A sample swagger-config.json:

{
  "urls": [
    {
      "url": "https://raw.githubusercontent.com/bbortt/swagger-ui-demo/master/files/pet-api.json",
      "name": "PetAPI"
    },
    {
      "url": "https://raw.githubusercontent.com/bbortt/swagger-ui-demo/master/files/store-api.json",
      "name": "StoreAPI"
    }
  ],
  "urls.primaryName": "PetAPI"
}

Running the Container

The following command demonstrates a sample container start:

docker run \
  --rm \
  -p 80:8080 \
  -e POLL_INTERVAL_SECONDS=60 \
  -e POLL_URL=https://raw.githubusercontent.com/bbortt/swagger-ui-demo/master/swagger-config.json \
  postfinance/polling-swagger-ui:$RELEASE_VERSION

Contributing

Contributors may find help in the DEVELOPMENT.md. It contains useful resources on how to behave when contributing, so we can accept your pull-requests without big trouble 😉

License

This project is licensed under the terms of the MIT License.