]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Command/Calendar2Command.php
Use google client id and secret env variables
[airbundle] / Command / Calendar2Command.php
index 76d5c4c34ee20af9e4445751b38664aa40013bee..ea218e3bad420ac782b45f8fe1b5cfc97620bebf 100644 (file)
@@ -26,9 +26,10 @@ use Symfony\Contracts\Translation\TranslatorInterface;
 
 use Twig\Extra\Markdown\DefaultMarkdown;
 
-use Rapsys\AirBundle\Entity\Session;
+use Rapsys\AirBundle\Command;
 use Rapsys\AirBundle\Entity\GoogleCalendar;
 use Rapsys\AirBundle\Entity\GoogleToken;
+use Rapsys\AirBundle\Entity\Session;
 
 use Rapsys\PackBundle\Util\SluggerUtil;
 
@@ -59,22 +60,18 @@ class Calendar2Command extends Command {
 
        /**
         * {@inheritdoc}
-        *
-        * @param string $project The google project
-        * @param string $client The google client
-        * @param string $secret The google secret
         */
-       public function __construct(ManagerRegistry $doctrine, RouterInterface $router, SluggerUtil $slugger, TranslatorInterface $translator, string $locale, string $project, string $client, string $secret) {
+       public function __construct(ManagerRegistry $doctrine, string $locale, RouterInterface $router, SluggerUtil $slugger, TranslatorInterface $translator) {
                //Call parent constructor
-               parent::__construct($doctrine, $router, $slugger, $translator, $locale);
+               parent::__construct($doctrine, $locale, $router, $slugger, $translator);
 
                //Set google client
                $this->client = new Client(
                        [
-                               'application_name' => $project,
-                               'client_id' => $client,
-                               'client_secret' => $secret,
-                               'redirect_uri' => $this->router->generate('rapsys_air_google_callback', [], UrlGeneratorInterface::ABSOLUTE_URL),
+                               'application_name' => $_ENV['RAPSYSAIR_GOOGLE_PROJECT'],
+                               'client_id' => $_ENV['GOOGLE_CLIENT_ID'],
+                               'client_secret' => $_ENV['GOOGLE_CLIENT_SECRET'],
+                               'redirect_uri' => $this->router->generate('rapsysair_google_callback', [], UrlGeneratorInterface::ABSOLUTE_URL),
                                'scopes' => $this->scopes,
                                'access_type' => 'offline',
                                #'login_hint' => $user->getMail(),