Skip to content

Commit

Permalink
Configure where to inject api key (header, query)
Browse files Browse the repository at this point in the history
  • Loading branch information
DarkaOnLine committed Sep 29, 2015
1 parent 6c0b2d5 commit 1a5416e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions config/l5-swagger.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@
*/
"api-key-var" => env('API_KEY_VAR', 'api_key'),

/*
|--------------------------------------------------------------------------
| Edit to set where to inject api key (header, query)
|--------------------------------------------------------------------------
*/
"api-key-inject" => env('API_KEY_INJECT', 'query'),

/*
|--------------------------------------------------------------------------
| Edit to set the api's version number
Expand Down
2 changes: 1 addition & 1 deletion resources/views/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
function addApiKeyAuthorization() {
var key = $('#input_apiKey')[0].value;
if(key && key.trim() != "") {
window.authorizations.add('{{$apiKeyVar}}', new ApiKeyAuthorization('{{$apiKeyVar}}', key, "query"));
window.authorizations.add('{{$apiKeyVar}}', new ApiKeyAuthorization('{{$apiKeyVar}}', key, "{{$apiKeyInject}}"));
}
}
Expand Down
1 change: 1 addition & 0 deletions src/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
view('l5-swagger::index', array(
'apiKey' => Config::get('l5-swagger.api-key'),
'apiKeyVar' => Config::get('l5-swagger.api-key-var'),
'apiKeyInject' => Config::get('l5-swagger.api-key-inject'),
'secure' => Request::secure(),
'urlToDocs' => url(Config::get('l5-swagger.doc-route')),
'requestHeaders' => Config::get('l5-swagger.requestHeaders')
Expand Down

0 comments on commit 1a5416e

Please sign in to comment.