diff --git a/src/Config.php b/src/Config.php index aaeee4d..c616132 100644 --- a/src/Config.php +++ b/src/Config.php @@ -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; @@ -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; @@ -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;