Skip to content

Commit b51bf27

Browse files
polarlightsdblock
authored andcommitted
Document #17: Use "request" data for default app_url. [ci skip]
1 parent 6f6e6dc commit b51bf27

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@ Create an initializer (e.g. `./config/initializers/swagger.rb`) and specify the
4545
```ruby
4646
GrapeSwaggerRails.options.url = '/swagger_doc.json'
4747
GrapeSwaggerRails.options.app_url = 'http://swagger.wordnik.com'
48+
``````
49+
50+
You can dynamically set `app_url` for each request use a `before_filter_proc`:
51+
52+
```ruby
53+
GrapeSwaggerRails.options.before_filter_proc = proc {
54+
GrapeSwaggerRails.options.app_url = request.protocol + request.host_with_port
55+
}
4856
```
4957

5058
You can set the app name, default is "Swagger".

0 commit comments

Comments
 (0)