Skip to content
Open
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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ docker run -d \

That's it.

# Decouple the api's name from the url path

The url pointing to a specific api uses the ```name``` value by default. In case you want to decouple the url path from the display name use the ```displayName``` attribute.

```console
docker run -d \
-p 8080:80 \
-e URLS="[{url: 'https://petstore.swagger.io/v2/swagger.json', name: 'petshop', displayName: '(public) Petshop'},{url: 'https://api.apis.guru/v2/specs/instagram.com/1.0.0/swagger.yaml', name: 'instagram', displayName: '(internal) Instagram'}]" \
volbrene/redoc
```

That's it.

## Environment variables

This image uses environment variables for configuration.
Expand Down
6 changes: 5 additions & 1 deletion app/src/RedocPage/RedocPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ class RedocPage extends Component {
super(props);

this.state = {
availableApis: window._env_.URLS.map(item => ({ value: slugify(item.name).toLowerCase(), label: item.name, url: item.url })),
availableApis: window._env_.URLS.map(item => ({
value: slugify(item.name).toLowerCase(),
label: item.displayName || item.name,
url: item.url
})),
activeApi: {
url: ''
}
Expand Down
6 changes: 5 additions & 1 deletion app/src/SelectApi/SelectApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ class SelectApi extends Component {
super(props);

this.state = {
availableApis: window._env_.URLS.map(item => ({ value: slugify(item.name).toLowerCase(), label: item.name, url: item.url })),
availableApis: window._env_.URLS.map(item => ({
value: slugify(item.name).toLowerCase(),
label: item.displayName || item.name,
url: item.url
})),
}
}

Expand Down