KnpLabs / KnpGaufretteBundle

Easily use Gaufrette in your Symfony projects.
http://knplabs.com
MIT License
717 stars 158 forks source link

Adapter is undefined when reffered from env variable #231

Open rgembalik opened 4 years ago

rgembalik commented 4 years ago

I am trying to configure a setup, where I can have several different installations, each allowing you to choose and configure adapter with the use of environmental variables.

However, when I pass a parameter that is an environmental variable, it is not being interpolated to the actual value.

The adapter in config is passed from a parameter, which is defined as such: '%env(UPLOAD_ADAPTER)%'.

But during cache:clear I get this error:

In KnpGaufretteExtension.php line 89:
The adapter '%env(UPLOAD_ADAPTER)%' is not defined.

All the other variables can be passed from the environmental variables. The adapter behind the env variable is defined. If I pass it directly to parameters in services.yaml it works. Originally I tried it with a '%env(default:default_adapter:UPLOAD_ADAPTER)%' notation, but that didn't work either.

Any ideas? I would be fine with any solution that lets me have default filesystem adapter and override it with e.g. S3 or Azure Blob adapter when there are certain variables defined.

EDIT: I am using bundle version 0.6.0, Symfony 4.4.1, tested with php 7.2, 7.3 and 7.4.