8p / EightPointsGuzzleBundle

⛽️ Integrates Guzzle 6.x, a PHP HTTP Client, into Symfony
MIT License
440 stars 71 forks source link

Symfony 4 config client base_url from .env #209

Closed KnechtRootRecht232 closed 6 years ago

KnechtRootRecht232 commented 6 years ago

How to set the base url in client-config with .env?

eight_points_guzzle:
    clients:
        my_client:
            # Write here the host where to do requests
            base_url: "%env(TARGET_URL)%"

this throws: Invalid configuration for path "eight_points_guzzle.clients.sc_inspirations.base_url": base_url can be: string

same when adding to parameters in services.yaml as config-var:

parameters:
    my_client.target_url: "%env(TARGET_URL)%"

and

eight_points_guzzle:
    clients:
        my_client:
            # Write here the host where to do requests
            base_url: "%my_client.target_url%"
Q A
Symfony version 4.1.3
Bundle version 7.3
KnechtRootRecht232 commented 6 years ago

solved it by my self:

'%env(string:TARGET_URL)%'