8p / EightPointsGuzzleBundle

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

Impossible to use environment variables as base_url value #233

Closed StarGuardian closed 6 years ago

StarGuardian commented 6 years ago
Q A
Symfony version 4.1.6
Bundle version 7.3.1

I try to use environment variable to set value of base_url parameter. eight_points_guzzle.yaml

eight_points_guzzle:
    clients:
        guardian_api:
            base_url: '%env(APIURL)%'
...

.env

APIURL=http://guardian.test/
...

But when I try to execute any symfony command I get error:

$ bin/console debug:config eight_points_guzzle
In BaseNode.php line 422:                                                                                                              
  Invalid configuration for path "eight_points_guzzle.clients.guardian_api.base_url": base_url can be: string  

In ExprBuilder.php line 189:                           
  base_url can be: string  

As far as I understand it happens because environment variable value resolved runtime, but I couldn't debug the issue.

gregurco commented 6 years ago

Hello.

Try to use next configuration:

parameters:
    env(APIURL): ''

eight_points_guzzle:
    clients:
        guardian_api:
            base_url: '%env(APIURL)%'
...
gregurco commented 6 years ago

@StarGuardian was the problem resolved? Can we close the issue?

StarGuardian commented 6 years ago

Yes, thank you. It works.