Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for multiple API URLs in Docker image #4044

Merged
merged 2 commits into from Jan 19, 2018

Conversation

phss
Copy link
Contributor

@phss phss commented Dec 20, 2017

Description

The API_URLS environment variable can be used to run the Docker image with multiple URLs.

Example:
docker run -p 80:8080 -e API_URLS=[{name:"First API", url:"http://firstapiurl"},{name:"Second API", url:"http://secondapiurl"}] swaggerapi/swagger-ui

Motivation and Context

Currently, there's no way to run the Docker container using multiple URLs, as specified in https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md

This follows the same pattern of variable substitution to replace url by urls with the value of $API_URLS

How Has This Been Tested?

Started up Docker locally with and without the API_URLS environment variable, to check it still works as expected.

Types of changes

  • No code changes (changes to documentation, CI, metadata, etc)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

The API_URLS environment variable can be used to run the Docker image with multiple urls.

Example:
docker run -p 80:8080 -e API_URLS=[{name:"First API", url:"http://firstapiurl"},{name:"Second API", url:"http://secondapiurl"}] swaggerapi/swagger-ui
@willejs
Copy link

willejs commented Jan 17, 2018

@shockey any thoughts on this?

@shockey
Copy link
Contributor

shockey commented Jan 18, 2018

CC: #3902

This seems alright to me. I'm not super excited by passing raw JSON through env vars, but it is the most direct way to do it.

@shockey shockey self-requested a review January 18, 2018 00:56
@shockey shockey added this to the January 19, 2018 milestone Jan 18, 2018
@shockey shockey merged commit f29202f into swagger-api:master Jan 19, 2018
@shockey
Copy link
Contributor

shockey commented Jan 19, 2018

thanks, @phss! this will go live tonight 😄

@shockey
Copy link
Contributor

shockey commented Jan 20, 2018

Working example in zsh:

docker run -p 80:8080 -e "API_URLS=[{name:\"Petstore\", url:\"http://petstore.swagger.io/v2/swagger.json\"},{name:\"USPTO\", url:\"https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/uspto.yaml\"}]" swaggerapi/swagger-ui

@yscialom
Copy link

yscialom commented May 22, 2020

As of v3.24.2, this feature is not available anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants