Skip to content

Commit b0749c8

Browse files
committed
Fix offloading logic
1 parent 5d65802 commit b0749c8

File tree

4 files changed

+36
-40
lines changed

4 files changed

+36
-40
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ The second argument of the `init` method is optional. It allows you to pass opti
3535
* `base_domain`: The base domain to connect to Optimole's API. Default is `i.optimole.com`.
3636
* `cache_buster`: A string value that will be appended to the URL of the optimized assets to bust Optimole's cache.
3737
* `dashboard_api_url`: The URL of the dashboard API. Default is `https://dashboard.optimole.com/api`.
38+
* `dashboard_api_key`: The API key to use for the dashboard API.
3839
* `upload_api_credentials`: An array with the credentials to use for the upload API. The array should contain the keys `userKey` and `secret`. The default is empty and the SDK will use the API key provided in the `init` method to fetch them from the dashboard API.
3940
* `upload_api_url`: The URL of the upload API. Default is `https://generateurls-prod.i.optimole.com/upload`.
4041

src/Offload/Manager.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@ class Manager
3131
*/
3232
private ClientInterface $httpClient;
3333

34-
/**
35-
* The Optimole API key.
36-
*/
37-
private string $key;
3834

3935
/**
4036
* The manager options.
@@ -44,7 +40,7 @@ class Manager
4440
/**
4541
* Constructor.
4642
*/
47-
public function __construct(ClientInterface $httpClient, string $key, array $options = [])
43+
public function __construct(ClientInterface $httpClient, array $options = [])
4844
{
4945
if (empty($options['dashboard_api_url'])) {
5046
throw new InvalidArgumentException('Missing "dashboard_api_url" option');
@@ -53,7 +49,6 @@ public function __construct(ClientInterface $httpClient, string $key, array $opt
5349
}
5450

5551
$this->httpClient = $httpClient;
56-
$this->key = $key;
5752
$this->options = array_merge([
5853
'upload_api_credentials' => [],
5954
], $options);

src/Optimole.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ private function createImage(string $imageUrl, string $cacheBuster = ''): Image
131131
*/
132132
private function createOffload(array $options = []): Manager
133133
{
134-
return new Manager($this->getHttpClient(), $this->key, array_merge($this->options, $options));
134+
return new Manager($this->getHttpClient(), array_merge($this->options, $options));
135135
}
136136

137137
/**

0 commit comments

Comments
 (0)