{"action":"created","issue":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/449","repository_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle","labels_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/449/labels{/name}","comments_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/449/comments","events_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/449/events","html_url":"https://github.com/FriendsOfSymfony/FOSHttpCacheBundle/issues/449","id":317724096,"node_id":"MDU6SXNzdWUzMTc3MjQwOTY=","number":449,"title":"Incompatible use of dynamic environment variables when configuring fos_http_cache.proxy_client.http...base_url","user":{"login":"hal869","id":36906232,"node_id":"MDQ6VXNlcjM2OTA2MjMy","avatar_url":"https://avatars1.githubusercontent.com/u/36906232?v=4","gravatar_id":"","url":"https://api.github.com/users/hal869","html_url":"https://github.com/hal869","followers_url":"https://api.github.com/users/hal869/followers","following_url":"https://api.github.com/users/hal869/following{/other_user}","gists_url":"https://api.github.com/users/hal869/gists{/gist_id}","starred_url":"https://api.github.com/users/hal869/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hal869/subscriptions","organizations_url":"https://api.github.com/users/hal869/orgs","repos_url":"https://api.github.com/users/hal869/repos","events_url":"https://api.github.com/users/hal869/events{/privacy}","received_events_url":"https://api.github.com/users/hal869/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-04-25T17:31:49Z","updated_at":"2018-06-14T06:27:37Z","closed_at":null,"author_association":"NONE","body":"With this config\r\n\r\n```\r\nfos_http_cache.yaml\r\n\tfos_http_cache:\r\n\t    proxy_client:\r\n\t        default: varnish\r\n\t        varnish:\r\n\t            http:\r\n\t                base_url: test.local.net:443\r\n```\r\n\r\nreplacing the *explicit* url with ENV var\r\n\r\n```\r\n.env\r\n\tBASE_URL='test.local.net'\r\n\r\nservices.yaml\r\n\tparameters:\r\n\t    base.url:   '%env(BASE_URL)%'\r\n\r\nfos_http_cache.yaml\r\n\tfos_http_cache:\r\n\t    proxy_client:\r\n\t        default: varnish\r\n\t        varnish:\r\n\t            http:\r\n-\t                base_url: test.local.net:443\r\n+\t                base_url: '%base.url%:443'\r\n```\r\n\r\nalso 'works' (no errors, haven't yet fully tested varnish purge etc)\r\n\r\nbut if you try to inject the PORT dynamically,\r\n\r\n```\r\n.env\r\n\tBASE_URL='test.local.net'\r\n+\tBASE_PORT='443'\r\n(or\tBASE_PORT=443)\r\n\r\nservices.yaml\r\n\tparameters:\r\n\t    base.url:   '%env(BASE_URL)%'\r\n+\t    base.port:  '%env(BASE_PORT)%'\r\n\r\nfos_http_cache.yaml\r\n\tfos_http_cache:\r\n\t    proxy_client:\r\n\t        default: varnish\r\n\t        varnish:\r\n\t            http:\r\n-\t                base_url: test.local.net:443\r\n-\t                base_url: '%base.url%:443'\r\n+\t                base_url: '%base.url%:%base.port%'\r\n```\r\n\r\nprofiler shows\r\n```\r\n(2/2) EnvParameterException\r\n\r\n\tIncompatible use of dynamic environment variables \"BASE_URL\", \"BASE_PORT\" found in parameters.\r\n\tin Compiler.php (line 112)\r\n\tat Compiler->compile(object(ContainerBuilder))in ContainerBuilder.php (line 713)\r\n\tat ContainerBuilder->compile()in Kernel.php (line 513)\r\n\tat Kernel->initializeContainer()in Kernel.php (line 125)\r\n\tat Kernel->boot()in Kernel.php (line 185)\r\n\tat Kernel->handle(object(Request))in index.php (line 37)\r\n\r\n(1/2) InvalidConfigurationException\r\n\r\n\tNot a valid base path: \"http://%env(BASE_URL)%:%env(BASE_PORT)%\"\r\n\tin FOSHttpCacheExtension.php (line 566)\r\n\tat FOSHttpCacheExtension->validateUrl('http://env_BASE_URL_82a306f54867199848964602d02a1770:env_BASE_PORT_806e9358ff4bd1bbdd72ce13ad0ce3ca', 'Not a valid base path: \"%s\"')in FOSHttpCacheExtension.php (line 379)\r\n\tat FOSHttpCacheExtension->createHttpDispatcherDefinition(object(MergeExtensionConfigurationContainerBuilder), array('servers' => array('127.0.0.1:6081'), 'base_url' => 'env_BASE_URL_82a306f54867199848964602d02a1770:env_BASE_PORT_806e9358ff4bd1bbdd72ce13ad0ce3ca', 'http_client' => null), 'fos_http_cache.proxy_client.varnish.http_dispatcher')in FOSHttpCacheExtension.php (line 399)\r\n\tat FOSHttpCacheExtension->loadVarnish(object(MergeExtensionConfigurationContainerBuilder), object(XmlFileLoader), array('tags_header' => 'X-Cache-Tags', 'header_length' => 7500, 'http' => array('servers' => array('127.0.0.1:6081'), 'base_url' => 'env_BASE_URL_82a306f54867199848964602d02a1770:env_BASE_PORT_806e9358ff4bd1bbdd72ce13ad0ce3ca', 'http_client' => null)))in FOSHttpCacheExtension.php (line 347)\r\n\tat FOSHttpCacheExtension->loadProxyClient(object(MergeExtensionConfigurationContainerBuilder), object(XmlFileLoader), array('default' => 'varnish', 'varnish' => array('tags_header' => 'X-Cache-Tags', 'header_length' => 7500, 'http' => array('servers' => array('127.0.0.1:6081'), 'base_url' => 'env_BASE_URL_82a306f54867199848964602d02a1770:env_BASE_PORT_806e9358ff4bd1bbdd72ce13ad0ce3ca', 'http_client' => null))))in FOSHttpCacheExtension.php (line 68)\r\n\tat FOSHttpCacheExtension->load(array(array('proxy_client' => array('default' => 'varnish', 'varnish' => array('tags_header' => 'X-Cache-Tags', 'header_length' => 7500, 'default_ban_headers' => null, 'http' => array('servers' => array('127.0.0.1:6081'), 'base_url' => 'env_BASE_URL_82a306f54867199848964602d02a1770:env_BASE_PORT_806e9358ff4bd1bbdd72ce13ad0ce3ca'))))), object(MergeExtensionConfigurationContainerBuilder))in MergeExtensionConfigurationPass.php (line 71)\r\n\tat MergeExtensionConfigurationPass->process(object(ContainerBuilder))in MergeExtensionConfigurationPass.php (line 39)\r\n\tat MergeExtensionConfigurationPass->process(object(ContainerBuilder))in Compiler.php (line 95)\r\n\tat Compiler->compile(object(ContainerBuilder))in ContainerBuilder.php (line 713)\r\n\tat ContainerBuilder->compile()in Kernel.php (line 513)\r\n\tat Kernel->initializeContainer()in Kernel.php (line 125)\r\n\tat Kernel->boot()in Kernel.php (line 185)\r\n\tat Kernel->handle(object(Request))in index.php (line 37)\r\n```\r\n\r\nand at console\r\n```\r\nbcs cache:clear\r\nstring(99) \"http://env_BASE_URL_91cc1a4dda9c935f7aa32b51209832e8:env_BASE_PORT_fae3ce89901ece848ab04cb8210721dd\"\r\n\r\nIn Compiler.php line 112:\r\n\r\n  Incompatible use of dynamic environment variables \"BASE_URL\", \"BASE_PORT\" found in parameters.\r\n\r\n\r\nIn FOSHttpCacheExtension.php line 566:\r\n\r\n  Not a valid base path: \"http://%env(BASE_URL)%:%env(BASE_PORT)%\"\r\n```\r\n\r\nfwi, references to similar/relevant(?) issue, re: injection of dynamic env vars in other bundle, snd-redis\r\n\r\nhttps://github.com/symfony/symfony/issues/20850\r\nhttps://github.com/symfony/symfony/commit/2422f7da9b004ef1a13c1429e711c7d4c03c239d\r\n\r\nAnd, just adding @dbu 's comment from Slack in case it disappears over there:\r\n> I'll have to check at which point variables are supposed to be resolved then. i thought it would be before we look at them ..."},"comment":{"url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/comments/397185567","html_url":"https://github.com/FriendsOfSymfony/FOSHttpCacheBundle/issues/449#issuecomment-397185567","issue_url":"https://api.github.com/repos/FriendsOfSymfony/FOSHttpCacheBundle/issues/449","id":397185567,"node_id":"MDEyOklzc3VlQ29tbWVudDM5NzE4NTU2Nw==","user":{"login":"dbu","id":76576,"node_id":"MDQ6VXNlcjc2NTc2","avatar_url":"https://avatars3.githubusercontent.com/u/76576?v=4","gravatar_id":"","url":"https://api.github.com/users/dbu","html_url":"https://github.com/dbu","followers_url":"https://api.github.com/users/dbu/followers","following_url":"https://api.github.com/users/dbu/following{/other_user}","gists_url":"https://api.github.com/users/dbu/gists{/gist_id}","starred_url":"https://api.github.com/users/dbu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dbu/subscriptions","organizations_url":"https://api.github.com/users/dbu/orgs","repos_url":"https://api.github.com/users/dbu/repos","events_url":"https://api.github.com/users/dbu/events{/privacy}","received_events_url":"https://api.github.com/users/dbu/received_events","type":"User","site_admin":false},"created_at":"2018-06-14T06:27:37Z","updated_at":"2018-06-14T06:27:37Z","author_association":"CONTRIBUTOR","body":"sorry, finally looked at this again. it seems we would need to actively do something in this case. (not fully sure if we need to adjust just the validation, or also how the service is set up). do you want to look into it and provide a pull request?"}}
{"actor":{"display_login":"dbu"}}