craftcms / google-cloud

Google Cloud Storage volume type for Craft CMS.
https://plugins.craftcms.com/google-cloud
MIT License
11 stars 10 forks source link

Allow .env variable for Bucket as volumes.php is deprecated #21

Closed maxstrebel closed 2 years ago

maxstrebel commented 3 years ago

Description

If you use different buckets for Dev, Staging and Production it is impossible to set the volumes reliably by .env variables. With the volumes.php deprecated, we need some way to set it. A side effect is, that these fields keep being overridden with a bucket name in the project config.

handle: ..
hasUrls: true
name: ...
settings:
  bucket: '' → can't be set reliably
  bucketSelectionMode: → can't be set reliably
  expires: ''
  keyFileContents: ''
  projectId: $GOOGLE_BUCKET_PROJECT_ID
  subfolder: $GOOGLE_BUCKET_IMAGES_FOLDER
sortOrder: 1
type: craft\googlecloud\Volume
url: $GOOGLE_BUCKET_BASE_URL → is sometimes overridden by the system

Solution

I'd be super happy if I could set bucket and url per environment. If there's another way besides the deprecated volumes.php, I'd be glad to know it.

andris-sevcenko commented 2 years ago

Just released the 1.4.1 version of this plugin that allows setting the bucket selection to manual mode, which, in turn, allows ENV variables.