Ver Fonte

Updated name connections to docker compose and containers.

Jean Sumara Leopoldo há 5 anos atrás
pai
commit
5daa1262bb

+ 0 - 1
composer.json

@@ -9,7 +9,6 @@
     }
   ],
   "require": {
-    "vlucas/phpdotenv": "*",
     "php-amqplib/php-amqplib": ">=2.6.1",
     "symfony/console": "3.4",
     "symfony/lock": "3.4",

+ 2 - 2
src/App/Helper/RedisHelper.php

@@ -62,7 +62,7 @@ class RedisHelper
 
     public static function lock($flag)
     {
-        $redisConnection = getenv('HOST_REDIS');
+        $redisConnection = "tcp://redis:6379";
         $redis = new Redis(array($redisConnection));
         $redis->connect();
 
@@ -89,7 +89,7 @@ class RedisHelper
 
     public static function removeLock($flag)
     {
-        $redisConnection = getenv('HOST_REDIS');
+        $redisConnection = "tcp://redis:6379";
         $redis = new Redis(array($redisConnection));
         $redis->connect();
 

+ 3 - 24
src/App/Listener/StatsConsumerListener.php

@@ -11,37 +11,16 @@ class StatsConsumerListener
 {
     private $connectionAMQP;
     private $channelAMQP;
-    private $nameQueue;
 
     public function __construct()
     {
-        $this->connectionAMQP = new AMQPStreamConnection(getenv('HOST_AMQP'), getenv('PORT_AMQP'), getenv('USER_AMQP'), getenv('PASS_AMQP'));
+        $this->connectionAMQP = new AMQPStreamConnection('amqp', '5672', 'guest', 'guest');
         $this->channelAMQP = $this->connectionAMQP->channel();
     }
 
-    /**
-     * @return mixed
-     */
-    public function getNameQueue()
-    {
-        return $this->nameQueue;
-    }
-
-    /**
-     * @param mixed $nameQueue
-     */
-    public function setNameQueue($nameQueue)
-    {
-        $this->nameQueue = $nameQueue;
-    }
-
     public function run(){
         echo 'Running listener';
 
-        $envNameQueue = getenv('NAME_QUEUE');
-        if($this->getNameQueue()){
-            $envNameQueue = $this->getNameQueue();
-        }
         $callbackMessage = function($msg) {
             $msgBody = unserialize($msg->body);
 
@@ -90,8 +69,8 @@ class StatsConsumerListener
             return false;
         };
 
-        $this->channelAMQP->queue_declare($envNameQueue, false, true ,false, false);
-        $this->channelAMQP->basic_consume($envNameQueue, '', false, true, false, false, $callbackMessage);
+        $this->channelAMQP->queue_declare('command.stats', false, true ,false, false);
+        $this->channelAMQP->basic_consume('command.stats', '', false, true, false, false, $callbackMessage);
 
         while (count($this->channelAMQP->callbacks)){
             try {

+ 1 - 1
src/App/Service/Redis/RedisService.php

@@ -19,7 +19,7 @@ class RedisService implements CollectorInterface
      */
     public function __construct()
     {
-        $this->redis = new Redis(array(getenv('HOST_REDIS')));
+        $this->redis = new Redis(array("tcp://redis:6379"));
     }
 
     /**

+ 1 - 1
src/App/Service/StatsD/StatsDService.php

@@ -11,7 +11,7 @@ class StatsDService
     public function __construct(){
         $this->config = array();
         $this->config["enabled"] = true;
-        $this->config["host"] = getenv('HOST_STATSD');
+        $this->config["host"] = 'statsd';
         $this->config["port"] = 8125;
     }
 

+ 4 - 4
src/Domain/Doctrine.php

@@ -21,10 +21,10 @@ class Doctrine
 
         $connectionOptions = array(
             'driver'   => 'pdo_mysql',
-            'host'     => getenv('HOST_MYSQL'),
-            'dbname'   => getenv('DBNAME_MYSQL'),
-            'user'     => getenv('USER_MYSQL'),
-            'password' => getenv('PASSWORD_MYSQL')
+            'host'     => 'mysql',
+            'dbname'   => 'fd3_stats',
+            'user'     => getenv('MYSQL_USER'),
+            'password' => getenv('MYSQL_PASSWORD')
         );
 
         try {