Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Made the base directory configurable

  • Loading branch information...
commit b633ff9063260b6b2d814e9d18c13baa7e481af2 1 parent 57744c8
@billybednar authored
View
1  DependencyInjection/Configuration.php
@@ -28,6 +28,7 @@ public function getConfigTreeBuilder()
$rootNode
->children()
->scalarNode('factory')->defaultValue('php')->end()
+ ->scalarNode('base_dir')->defaultValue('%kernel.root_dir%')->end()
->end()
;
View
1  DependencyInjection/IgorwFileServeExtension.php
@@ -17,5 +17,6 @@ public function load(array $configs, ContainerBuilder $container)
$configuration = new Configuration();
$config = $this->processConfiguration($configuration, $configs);
$container->setAlias('igorw_file_serve.response_factory', sprintf('igorw_file_serve.response_factory.%s', $config['factory']));
+ $container->setParameter('igorw_file_serve.base_dir', $config['base_dir']);
}
}
View
7 README.md
@@ -30,7 +30,7 @@ Add the FileServeBundle to your application's kernel:
## Usage
-Use the `igorw_file_serve.response_factory` service to create a FileServe response. The path is relative to the `app` directory.
+Use the `igorw_file_serve.response_factory` service to create a FileServe response. The path is relative to the `app` directory by default.
$response = $this->get('igorw_file_serve.response_factory')->create('../VERSION', 'text/plain');
@@ -39,6 +39,11 @@ You can configure the factory used, for example to use a nginx XSendfile respons
igorw_file_serve:
factory: sendfile # The default value is "php"
+You can also configure the base directory:
+
+ igorw_file_serve:
+ base_dir: /files/dir # The default value is "%kernel.root_dir%"
+
## Features
* Incremental serving of large files
View
4 Resources/config/services.xml
@@ -11,10 +11,10 @@
<services>
<service id="igorw_file_serve.response_factory.php" class="%igorw_file_serve.response_factory.php.class%" public="false">
- <argument>%kernel.root_dir%</argument>
+ <argument>%igorw_file_serve.base_dir%</argument>
</service>
<service id="igorw_file_serve.response_factory.sendfile" class="%igorw_file_serve.response_factory.sendfile.class%" public="false">
- <argument>%kernel.root_dir%</argument>
+ <argument>%igorw_file_serve.base_dir%</argument>
</service>
</services>
</container>
Please sign in to comment.
Something went wrong with that request. Please try again.