This repository was archived by the owner on Nov 9, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -72,6 +72,8 @@ Jobs pushed to the remote queue are transmitted via HTTP and processed on anothe
72
72
'url' => 'http://192.168.100.100/api/v1/remote-queue/',
73
73
// Token to use for authentication on the remote host.
74
74
'token' => 'IoO2l7UKZfso5zQloF2XvAShEbAR5a9M8u+WBfg0HgI=',
75
+ // Optional additional request options for the GuzzleHttp client.
76
+ 'request_options' => [],
75
77
]
76
78
```
77
79
Original file line number Diff line number Diff line change @@ -15,10 +15,17 @@ class RemoteConnector implements ConnectorInterface
15
15
*/
16
16
public function connect (array $ config )
17
17
{
18
- $ client = new Client ([
19
- 'base_uri ' => $ config ['url ' ],
20
- 'headers ' => ['Authorization ' => "Bearer {$ config ['token ' ]}" ]
21
- ]);
18
+ $ requestOptions = [];
19
+ if (isset ($ config ['request_options ' ]) && is_array ($ config ['request_options ' ])) {
20
+ $ requestOptions = $ config ['request_options ' ];
21
+ }
22
+
23
+ // The URI should not be overridable by custom request options.
24
+ $ requestOptions ['base_uri ' ] = $ config ['url ' ];
25
+
26
+ $ client = new Client (array_merge_recursive ($ requestOptions , [
27
+ 'headers ' => ['Authorization ' => "Bearer {$ config ['token ' ]}" ],
28
+ ]));
22
29
23
30
return new RemoteQueue ($ client , $ config ['queue ' ]);
24
31
}
You can’t perform that action at this time.
0 commit comments