AcceleratorCacheBundle icon indicating copy to clipboard operation
AcceleratorCacheBundle copied to clipboard

Add support for environment variables

Open qzminski opened this issue 5 years ago • 0 comments

Given this configuration:

accelerator_cache:
    host: "%env(ACCELERATOR_CACHE_HOST)%"
    web_dir: "%kernel.root_dir%/../web"

and this .env file:

ACCELERATOR_CACHE_HOST=https://www.domain.tld

The command will not work because it will try to fetch the http://https://www.domain.tld/apc-*.php URL. Actual problem lies here:

https://github.com/Smart-Core/AcceleratorCacheBundle/blob/master/DependencyInjection/Configuration.php#L23

The moment a bundle configuration is processed, the $v does not yet contain the environment variable value (i.e. https://www.domain.tld), but rather a variable temporary name (e.g. env_dc3b1098b7dfc6db_ACCELERATOR_CACHE_HOST_93ccaa97cef7fc766f177ccffea2b95b), thus always receiving the http:// prefix.

qzminski avatar May 20 '20 13:05 qzminski