Closed kobeaerts closed 5 years ago
Added environment variable support to the Project ID and Subfolder settings for the next release, but not Bucket yet. (Even our S3 plugin doesn’t let you set the Bucket setting to an environment variable yet.)
You guys are amazing!
Hi @brandonkelly.
I am having an issue with env vars... we are doing some major re-structuring to our local site which will be deployed to staging. However, because we can't change the bucket locally to a test bucket, the changes we are making are causing loads of issues on production due to assets being transformed in the wrong locations based on the structure we've assigned locally.
How would you suggest we handle this if we can't change the bucket in different env vars?
Ideally we need a way to point our local env to a completely different bucket or volume. (removing the ID from the account didn't help as I believe access is provided via the access key file, which also isn't env defined)
In future, i'm sure it would be fine to set up different subfolders using env vars, but as this is already a live project, the migration still seems to affect previous data that the live site still needed.
@toddpadwick you can create config overrides in a config/volumes.php
file, where you return a nested array like this:
<?php
return [
'volumeHandle' => [
'bucket' => getenv('TEST_BUCKET')
]
];
Using the volume.php
was documented a while ago, but was removed due to the addition of environmental variables. You can see the removed bit here.
Hope that helps!
Thank you so much for this, @andris-sevcenko. @brandonkelly would you mind to either add @andris-sevcenko's hint this to the docs or accept a pull-request with a bit more config guidance?
@toddpadwick you can create config overrides in a
config/volumes.php
file, where you return a nested array like this:<?php return [ 'volumeHandle' => [ 'bucket' => getenv('TEST_BUCKET') ] ];
Using the
volume.php
was documented a while ago, but was removed due to the addition of environmental variables. You can see the removed bit here.Hope that helps!
Support for overriding volume configs in config/volumes.php has been deprecated. Could you add a sample to override bucket name via recommended dependency injection? Or maybe there is some other simple way? Thanks.
@toddpadwick you can create config overrides in a
config/volumes.php
file, where you return a nested array like this:<?php return [ 'volumeHandle' => [ 'bucket' => getenv('TEST_BUCKET') ] ];
Using the
volume.php
was documented a while ago, but was removed due to the addition of environmental variables. You can see the removed bit here. Hope that helps!Support for overriding volume configs in config/volumes.php has been deprecated. Could you add a sample to override bucket name via recommended dependency injection? Or maybe there is some other simple way? Thanks.
Is there any update on this? The current solution also keeps writing the actual bucket name into project.config instead of the dynamic config. Any help is very appreciated.
Can these fields be .env variables: