Skip to content
Snippets Groups Projects
Commit f13ceea0 authored by Sebastien Rosset's avatar Sebastien Rosset
Browse files

Fix webhooks process

parent 639fc742
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration # https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters: parameters:
app.version: 3.2.3 app.version: 3.2.3
use_as_sass: "%env(USE_AS_SAAS)%"
locale: fr locale: fr
router.request_context.host: '%env(string:BASE_URL)%' router.request_context.host: '%env(string:BASE_URL)%'
from_email: "%env(FROM_EMAIL)%" from_email: "%env(FROM_EMAIL)%"
...@@ -20,4 +19,4 @@ parameters: ...@@ -20,4 +19,4 @@ parameters:
oauth_google_secret: '%env(OAUTH_GOOGLE_SECRET)%' oauth_google_secret: '%env(OAUTH_GOOGLE_SECRET)%'
oauth_facebook_id: '%env(OAUTH_FACEBOOK_ID)%' oauth_facebook_id: '%env(OAUTH_FACEBOOK_ID)%'
oauth_facebook_secret: '%env(OAUTH_FACEBOOK_SECRET)%' oauth_facebook_secret: '%env(OAUTH_FACEBOOK_SECRET)%'
doctrine_mongodb.odm.fixtures_dirs: ['src/DataFixtures/MongoDB'] doctrine_mongodb.odm.fixtures_dirs: ['src/DataFixtures/MongoDB']
\ No newline at end of file
...@@ -44,7 +44,7 @@ services: ...@@ -44,7 +44,7 @@ services:
arguments: arguments:
$baseUrl: '%base_url%' $baseUrl: '%base_url%'
$baseProtocol: '%base_protocol%' $baseProtocol: '%base_protocol%'
$useAsSaas: '%use_as_sass%' $useAsSaas: '%use_as_saas%'
App\Services\MailService: App\Services\MailService:
arguments: arguments:
......
...@@ -55,16 +55,16 @@ class GoGoAbstractCommand extends Command ...@@ -55,16 +55,16 @@ class GoGoAbstractCommand extends Command
} else if ($input->getArgument('dbname')) { } else if ($input->getArgument('dbname')) {
$this->dm = $this->dmFactory->switchCurrManagerToUseDb($input->getArgument('dbname')); $this->dm = $this->dmFactory->switchCurrManagerToUseDb($input->getArgument('dbname'));
$this->gogoExecute($this->dm, $input, $output); $this->gogoExecute($this->dm, $input, $output);
} else if ($_ENV['USE_AS_SAAS']) { } else if ($_ENV['USE_AS_SAAS'] === 'true') {
$qb = $this->dm->query('Project'); $qb = $this->dm->query('Project');
$this->filterProjects($qb); $this->filterProjects($qb);
$dbs = $qb->select('domainName')->getArray(); $dbs = $qb->select('domainName')->getArray();
$count = count($dbs); $count = count($dbs);
$this->log("---- Run {$this->getName()} for $count projects", false); $this->log("---- Run {$this->getName()} for $count projects", false);
foreach($dbs as $dbName) { foreach($dbs as $dbName) {
$this->dm = $this->dmFactory->createForDB($dbName);; $this->dm = $this->dmFactory->createForDB($dbName);;
$this->gogoExecute($this->dm, $input, $output); $this->gogoExecute($this->dm, $input, $output);
} }
} else { } else {
$this->dm = $this->dmFactory->getRootManager(); $this->dm = $this->dmFactory->getRootManager();
$this->gogoExecute($this->dm, $input, $output); $this->gogoExecute($this->dm, $input, $output);
...@@ -102,7 +102,7 @@ class GoGoAbstractCommand extends Command ...@@ -102,7 +102,7 @@ class GoGoAbstractCommand extends Command
$this->dm->persist($log); $this->dm->persist($log);
$message = "DB {$this->dm->getConfiguration()->getDefaultDB()} : $message"; $message = "DB {$this->dm->getConfiguration()->getDefaultDB()} : $message";
$this->logger->error($message); $this->logger->error($message);
$this->output->writeln('ERROR '.$message); $this->output->writeln('ERROR '.$message);
$this->dm->flush(); $this->dm->flush();
} }
} }
...@@ -67,8 +67,8 @@ class WebhookService ...@@ -67,8 +67,8 @@ class WebhookService
$webhook = $post->getWebhook(); $webhook = $post->getWebhook();
if ($webhook) { if ($webhook) {
$jsonData = json_encode($this->formatData($webhook->getFormat(), $data)); $jsonData = $this->formatData($webhook->getFormat(), $data);
$promise = $client->postAsync($webhook->getUrl(), [], $jsonData); $promise = $client->postAsync($webhook->getUrl(), ['json' => $jsonData]);
} else { } else {
// when no webhook it mean it's a special handling, like for OpenStreetMap // when no webhook it mean it's a special handling, like for OpenStreetMap
$promise = $this->synchService->asyncDispatch($contribution, $data); $promise = $this->synchService->asyncDispatch($contribution, $data);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment