Skip to content

Commit

Permalink
Add endpoint config
Browse files Browse the repository at this point in the history
  • Loading branch information
timkelty committed Dec 22, 2023
1 parent 7588465 commit 3f81e14
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
class Config extends BaseConfig
{
public ?string $artifactBaseUrl = null;
public array $s3ClientOptions = [];
public string $cdnBaseUrl = 'https://cdn.craft.cloud';
public ?string $sqsUrl = null;
public ?string $projectId = null;
Expand All @@ -29,7 +28,9 @@ class Config extends BaseConfig
public bool $useAssetBundleCdn = true;
public ?string $previewDomain = null;
public bool $useQueue = true;
public ?string $s3Endpoint = null;
protected ?string $region = null;
protected array $s3ClientOptions = [];
protected bool $useAssetCdn = true;
protected bool $useArtifactCdn = true;

Expand Down Expand Up @@ -63,6 +64,21 @@ public function __call($name, $params)
return parent::__call($name, $params);
}

public function getS3ClientOptions(): array
{
return $this->s3ClientOptions + array_filter([
'use_path_style_endpoint' => (bool) $this->s3Endpoint,
'endpoint' => $this->s3Endpoint,
]);
}

public function setS3ClientOptions(array $s3ClientOptions): static
{
$this->s3ClientOptions = $s3ClientOptions;

return $this;
}

public function getUseAssetCdn(): bool
{
return App::env('CRAFT_CLOUD_USE_ASSET_CDN') ?? $this->useAssetCdn;
Expand Down

0 comments on commit 3f81e14

Please sign in to comment.