Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,16 @@ docker run -d -p 80:8080 -v $(pwd):/tmp -e SWAGGER_FILE=/tmp/swagger.json swagge
docker run -d -p 80:8080 -e BASE_URL=/swagger-editor swaggerapi/swagger-editor
```

You can also customize the different endpoints used by the Swagger Editor with the following environment variables. For instance, this can be useful if you have your own Swagger generator server:

Environment variable | Default value
--- | ---
`URL_SWAGGER2_GENERATOR` | `https://generator.swagger.io/api/swagger.json`
`URL_OAS3_GENERATOR` | `https://generator3.swagger.io/openapi.json`
`URL_SWAGGER2_CONVERTER` | `https://converter.swagger.io/api/convert`

If you want to run the Swagger Editor locally without the Codegen features (Generate Server and Generate Client) you can set the above environment variables to `null` (`URL_SWAGGER2_CONVERTER=null`).

### Building and running an image locally

To build and run a docker image with the code checked out on your machine, run the following from the root directory of the project:
Expand Down
24 changes: 24 additions & 0 deletions docker-run.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,30 @@ if [[ "${QUERY_CONFIG_ENABLED}" = "true" ]]; then
sed -i "s|queryConfigEnabled: false|queryConfigEnabled: true|" $INDEX_FILE
fi

if [[ "${URL_SWAGGER2_GENERATOR}" ]]; then
if [[ "$URL_SWAGGER2_GENERATOR" != "null" ]]; then
sed -i "s|SwaggerEditorBundle({|SwaggerEditorBundle({\n swagger2GeneratorUrl: '${URL_SWAGGER2_GENERATOR}',|g" $INDEX_FILE
else
sed -i "s|SwaggerEditorBundle({|SwaggerEditorBundle({\n swagger2GeneratorUrl: null,|g" $INDEX_FILE
fi
fi

if [[ "${URL_SWAGGER2_CONVERTER}" ]]; then
if [[ "$URL_SWAGGER2_CONVERTER" != "null" ]]; then
sed -i "s|SwaggerEditorBundle({|SwaggerEditorBundle({\n swagger2ConverterUrl: '${URL_SWAGGER2_CONVERTER}',|g" $INDEX_FILE
else
sed -i "s|SwaggerEditorBundle({|SwaggerEditorBundle({\n swagger2ConverterUrl: null,|g" $INDEX_FILE
fi
fi

if [[ "${URL_OAS3_GENERATOR}" ]]; then
if [[ "$URL_OAS3_GENERATOR" != "null" ]]; then
sed -i "s|SwaggerEditorBundle({|SwaggerEditorBundle({\n oas3GeneratorUrl: '${URL_OAS3_GENERATOR}',|g" $INDEX_FILE
else
sed -i "s|SwaggerEditorBundle({|SwaggerEditorBundle({\n oas3GeneratorUrl: null,|g" $INDEX_FILE
fi
fi

exec nginx -g 'daemon off;'

## Gzip after replacements
Expand Down