diff --git a/README.md b/README.md index 847bdb2..94347e2 100644 --- a/README.md +++ b/README.md @@ -198,28 +198,23 @@ Most configuration (to Craft and the extension itself) is handled directly by Cl | Option | Type | Description | |-----------------------|----------------|---------------------------------------------------------------------------------------------------------------------------------| | `artifactBaseUrl` | `string\|null` | Directly set a fully-qualified URL to build artifacts. | +| `resourceBaseUrl` | `string\|null` | Override CP resource URLs, for example `@web/cpresources`. Unset or empty values use the Cloud CDN. | | `s3ClientOptions` | `array` | Additional settings to pass to the `Aws\S3\S3Client` instance when accessing storage APIs. | -| `cdnBaseUrl` | `string` | Used when building URLs to [assets](#filesystem) and other build [artifacts](#artifacturl). | | `gatewayBaseUrl` | `string` | Used when making gateway API requests. | -| `sqsUrl` | `string` | Determines how Craft communicates with the underlying queue provider. | -| `projectId` | `string` | UUID of the current project. | -| `environmentId` | `string` | UUID of the current [environment](https://craftcms.com/knowledge-base/cloud-environments). | -| `buildId` | `string` | UUID of the current [build](https://craftcms.com/knowledge-base/cloud-builds). | +| `projectId` | `string` | Read-only in Craft Cloud environments. UUID of the current project. | +| `environmentId` | `string` | Read-only in Craft Cloud environments. UUID of the current [environment](https://craftcms.com/knowledge-base/cloud-environments). | +| `buildId` | `string` | Read-only in Craft Cloud environments. UUID of the current [build](https://craftcms.com/knowledge-base/cloud-builds). | | `accessKey` | `string` | AWS access key, used for communicating with storage APIs. | | `accessSecret` | `string` | AWS access secret, used in conjunction with the `accessKey`. | | `accessToken` | `string` | AWS access token. | -| `redisUrl` | `string` | Connection string for the environment’s Redis instance. | -| `signingKey` | `string` | A secret value used to protect transform URLs and sign HTTP requests. | -| `useAssetBundleCdn` | `boolean` | Whether or not to enable the CDN for asset bundles. | -| `previewDomain` | `string\|null` | Set when accessing an environment from its [preview domain](https://craftcms.com/knowledge-base/cloud-domains#preview-domains). | +| `signingKey` | `string` | Read-only in Craft Cloud environments. A secret value used to protect transform URLs and sign HTTP requests. | | `useQueue` | `boolean` | Whether or not to use Cloud’s SQS-backed queue driver. | | `region` | `string` | The app region, chosen when creating the project. | | `useAssetCdn` | `boolean` | Whether or not to enable the CDN for uploaded assets. | -| `useArtifactCdn` | `boolean` | Whether or not to enable the CDN for build artifacts and asset bundles. | | `staticCacheDuration` | `int` | The default duration, in seconds, to statically cache requests. | > [!TIP] -> These options can also be set via environment overrides beginning with `CRAFT_CLOUD_`. +> Options marked read-only are provided by Craft Cloud. Other options can also be set via environment overrides beginning with `CRAFT_CLOUD_`. ### Static cache diff --git a/src/Config.php b/src/Config.php index 97a3345..cf2d591 100644 --- a/src/Config.php +++ b/src/Config.php @@ -18,6 +18,7 @@ class Config extends BaseConfig { public ?string $artifactBaseUrl = null; + public ?string $resourceBaseUrl = null; public string $cdnBaseUrl = 'https://cdn.craft.cloud'; public string $gatewayBaseUrl = 'https://gateway.craft.cloud'; public bool $gzipResponse = true; @@ -30,6 +31,7 @@ class Config extends BaseConfig public ?string $accessToken = null; public ?string $redisUrl = null; public ?string $signingKey = null; + /** @deprecated No longer used by the Cloud extension. */ public ?string $previewDomain = null; public bool $useQueue = true; public int $staticCacheDuration = DateTimeHelper::SECONDS_YEAR; @@ -133,6 +135,7 @@ public function getShortEnvironmentId(): ?string : null; } + /** @deprecated No longer used by the Cloud extension. */ public function getPreviewDomainUrl(): ?UriInterface { if (!$this->previewDomain) { diff --git a/src/fs/CpResourcesFs.php b/src/fs/CpResourcesFs.php index bb5abc7..855c892 100644 --- a/src/fs/CpResourcesFs.php +++ b/src/fs/CpResourcesFs.php @@ -2,10 +2,17 @@ namespace craft\cloud\fs; +use craft\cloud\Module; use League\Uri\Contracts\SegmentedPathInterface; class CpResourcesFs extends BuildsFs { + public function init(): void + { + parent::init(); + $this->baseUrl = Module::getInstance()->getConfig()->resourceBaseUrl; + } + public function createBucketPrefix(): SegmentedPathInterface { return parent::createBucketPrefix()->append('cpresources');