OneupFlysystemBundle icon indicating copy to clipboard operation
OneupFlysystemBundle copied to clipboard

Can't use env() in bundle configuration

Open Bukashk0zzz opened this issue 8 years ago • 8 comments

Hi,

I use new Dotenv symfony component. I can't define adapter name using env parameter.

Get error [LogicException] The adapter 'env_UPLOADS_PUBLIC_FLYSYSTEM_ADAPTER_e4fc4c42495a301a782e1f2d4704048f' is not defined.

My config:

oneup_flysystem:
    adapters:
        s3_public:
            awss3v3:
                client: aws.s3.client
                bucket: '%aws.s3.cdn.bucket%'
                prefix: '%env(UPLOADS_PUBLIC_PATH)%'

    filesystems:
        uploads_public:
            adapter: '%env(UPLOADS_PUBLIC_FLYSYSTEM_ADAPTER)%'
            mount: uploads_public
            visibility: public
            disable_asserts: false

Bukashk0zzz avatar Oct 30 '17 12:10 Bukashk0zzz

@Bukashk0zzz did you try to use a parameter ?

parameters:
    flysystem_adapter: '%env(UPLOADS_PUBLIC_FLYSYSTEM_ADAPTER)%' <---

oneup_flysystem:
    adapters:
        s3_public:
            awss3v3:
                client: aws.s3.client
                bucket: '%aws.s3.cdn.bucket%'
                prefix: '%env(UPLOADS_PUBLIC_PATH)%'

     filesystems:
        uploads_public:
            adapter: '%flysystem_adapter%' <---
            mount: uploads_public
            visibility: public
            disable_asserts: false`

Algatux avatar Apr 04 '18 09:04 Algatux

Yes, I changed all to parameters already, but this workaround not solution for this issue.

Bukashk0zzz avatar Apr 04 '18 09:04 Bukashk0zzz

I have the same story:

        current:
            adapter: '%env(FILESYSTEM_ADAPTER)%' 

The adapter '%env(FILESYSTEM_ADAPTER)%' is not defined.

drcreazy avatar May 11 '18 13:05 drcreazy

I tired to use the workaround but I am still getting the problem. Would you be able to explain how does this workaround fix that issues? Does the parameters get process before rest of the config?

I am using symfony 4.0

lisfox1 avatar Jun 25 '18 14:06 lisfox1

@lisfox1 , I've just separate adapter conf files: project/app/config/config_dev.yml

oneup_flysystem:
    filesystems:
        current:
            adapter: 'dev_adapter'

project/app/config/config_prod.yml

oneup_flysystem:
    filesystems:
        current:
            adapter: 's3_adapter'

I'm not sure that sf4 is used same config approach

drcreazy avatar Jun 25 '18 14:06 drcreazy

I get the same error. Did anyone find a solution to get this working with environments instead of separate configuration files?

FrankGiesecke avatar Jan 23 '19 14:01 FrankGiesecke

I had similar issue with my config due to use %kernel.project_dir% route in my .env file. I solved with resolve env var processor: https://symfony.com/doc/current/configuration/env_var_processors.html

keyFilePath: '%env(resolve:GOOGLE_STORAGE_CLIENT_KEY)%'

Maybe it helps you

papelbe avatar Oct 24 '19 14:10 papelbe

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Dec 22 '20 16:12 stale[bot]