Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow .env variables #7

Closed
kobeaerts opened this issue Feb 5, 2019 · 7 comments
Closed

Allow .env variables #7

kobeaerts opened this issue Feb 5, 2019 · 7 comments

Comments

@kobeaerts
Copy link

Can these fields be .env variables:

  • Project ID
  • Bucket
  • Subfolder
@brandonkelly
Copy link
Member

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.)

@kobeaerts
Copy link
Author

You guys are amazing!

@toddpadwick
Copy link

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.

@andris-sevcenko
Copy link
Contributor

@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!

@maxstrebel
Copy link

maxstrebel commented Apr 29, 2020

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?

@umkasanki
Copy link

@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.
изображение

@maxstrebel
Copy link

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants