Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 3 additions & 0 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -133,6 +135,7 @@ public function getShortEnvironmentId(): ?string
: null;
}

/** @deprecated No longer used by the Cloud extension. */
public function getPreviewDomainUrl(): ?UriInterface
{
if (!$this->previewDomain) {
Expand Down
7 changes: 7 additions & 0 deletions src/fs/CpResourcesFs.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
Loading