]> Raphaƫl G. Git Repositories - packbundle/blobdiff - DependencyInjection/Configuration.php
Use bundle alias and version as user agent
[packbundle] / DependencyInjection / Configuration.php
index 0265db3833bedf535d3998bb61150571041b51f4..2e57ae864af747a11ac4e51e70377341532c86e4 100644 (file)
@@ -13,8 +13,11 @@ namespace Rapsys\PackBundle\DependencyInjection;
 
 use Symfony\Component\Config\Definition\Builder\TreeBuilder;
 use Symfony\Component\Config\Definition\ConfigurationInterface;
+use Symfony\Component\DependencyInjection\Container;
 use Symfony\Component\Process\ExecutableFinder;
 
+use Rapsys\PackBundle\RapsysPackBundle;
+
 /**
  * This is the class that validates and merges configuration from your app/config files.
  *
@@ -28,7 +31,7 @@ class Configuration implements ConfigurationInterface {
         */
        public function getConfigTreeBuilder(): TreeBuilder {
                //Get TreeBuilder object
-               $treeBuilder = new TreeBuilder('rapsys_pack');
+               $treeBuilder = new TreeBuilder($alias = RapsysPackBundle::getAlias());
 
                //Get ExecutableFinder object
                $finder = new ExecutableFinder();
@@ -39,9 +42,11 @@ class Configuration implements ConfigurationInterface {
                                'name' => 'asset_url',
                                'scheme' => 'https://',
                                'timeout' => (int)ini_get('default_socket_timeout'),
-                               'agent' => (string)ini_get('user_agent')?:'rapsys_pack/0.2.0',
+                               'agent' => $alias.'/'.($version = RapsysPackBundle::getVersion()),
                                'redirect' => 5
                        ],
+                       #TODO: migrate to public.path, public.url and router->generateUrl ?
+                       #XXX: that would means dropping the PathPackage stuff and use static route like rapsys_pack_facebook
                        'output' => [
                                'css' => '@RapsysPack/css/*.pack.css',
                                'js' =>  '@RapsysPack/js/*.pack.js',
@@ -72,7 +77,8 @@ class Configuration implements ConfigurationInterface {
                                                'args' => []
                                        ]
                                ],
-                       ]
+                       ],
+                       'path' => dirname(__DIR__).'/Resources/public',
                ];
 
                /**
@@ -180,6 +186,7 @@ class Configuration implements ConfigurationInterface {
                                                        ->end()
                                                ->end()
                                        ->end()
+                                       ->scalarNode('path')->cannotBeEmpty()->defaultValue($defaults['path'])->end()
                                ->end()
                        ->end();