|
@@ -2,6 +2,8 @@
|
|
|
|
|
|
use Symfony\Component\HttpKernel\Kernel;
|
|
|
use Symfony\Component\Config\Loader\LoaderInterface;
|
|
|
+use Symfony\Component\HttpKernel\HttpKernelInterface;
|
|
|
+use Symfony\Component\HttpFoundation\Request;
|
|
|
|
|
|
class AppKernel extends Kernel
|
|
|
{
|
|
@@ -15,7 +17,7 @@ class AppKernel extends Kernel
|
|
|
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
|
|
|
new Doctrine\Bundle\DoctrineBundle\DoctrineBundle(),
|
|
|
new Sensio\Bundle\FrameworkExtraBundle\SensioFrameworkExtraBundle(),
|
|
|
-
|
|
|
+
|
|
|
new Sonata\CoreBundle\SonataCoreBundle(),
|
|
|
new Sonata\BlockBundle\SonataBlockBundle(),
|
|
|
new Sonata\DoctrineORMAdminBundle\SonataDoctrineORMAdminBundle(),
|
|
@@ -30,14 +32,14 @@ class AppKernel extends Kernel
|
|
|
|
|
|
new MigrationsBundle\MigrationsBundle(),
|
|
|
new Doctrine\Bundle\MigrationsBundle\DoctrineMigrationsBundle(),
|
|
|
-
|
|
|
+
|
|
|
new WebserviceBundle\WebserviceBundle(),
|
|
|
new Base\AdminBundle\BaseAdminBundle(),
|
|
|
new Base\OAuthClientBundle\BaseOAuthClientBundle(),
|
|
|
new DeviceBundle\DeviceBundle(),
|
|
|
new ExtraDataBundle\ExtraDataBundle(),
|
|
|
new OwnerVoterBundle\OwnerVoterBundle(),
|
|
|
-
|
|
|
+
|
|
|
new StatsBundle\StatsBundle(),
|
|
|
new RedisBundle\RedisBundle(),
|
|
|
new BaseStatsBundle\BaseStatsBundle(),
|
|
@@ -73,16 +75,35 @@ class AppKernel extends Kernel
|
|
|
|
|
|
public function getCacheDir()
|
|
|
{
|
|
|
- return dirname(__DIR__).'/var/cache/'.$this->getEnvironment();
|
|
|
+ return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment();
|
|
|
}
|
|
|
|
|
|
public function getLogDir()
|
|
|
{
|
|
|
- return dirname(__DIR__).'/var/logs';
|
|
|
+ return dirname(__DIR__) . '/var/logs';
|
|
|
}
|
|
|
|
|
|
public function registerContainerConfiguration(LoaderInterface $loader)
|
|
|
{
|
|
|
- $loader->load($this->getRootDir().'/config/config_'.$this->getEnvironment().'.yml');
|
|
|
+ $loader->load($this->getRootDir() . '/config/config_' . $this->getEnvironment() . '.yml');
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * {@inheritdoc}
|
|
|
+ */
|
|
|
+ public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
|
|
|
+ {
|
|
|
+ if (false === $this->booted) {
|
|
|
+ $this->boot();
|
|
|
+ }
|
|
|
+ // se puede sacar la variable nginx-proxy porque es el nombre del docker y puede variar
|
|
|
+ // con REMOTRA_ADDR obtengo el mismo valor (http://symfony.com/doc/current/deployment/proxies.html)
|
|
|
+ //gethostbyname("nginx-proxy") == $request->server->get('REMOTE_ADDR')
|
|
|
+ if ($this->container->hasParameter("nginx_name")) {
|
|
|
+ Request::setTrustedProxies(
|
|
|
+ array('127.0.0.1', $this->container->getParameter("nginx_name")),
|
|
|
+ Request::HEADER_X_FORWARDED_FOR);
|
|
|
+ }
|
|
|
+ return parent::handle($request, $type, $catch);
|
|
|
}
|
|
|
}
|