Show git branch and commit hash on homepage if available.

This commit is contained in:
Jan Böhmer 2019-10-13 00:44:50 +02:00
parent 3c16632a89
commit 329d8c871e
3 changed files with 86 additions and 5 deletions

View file

@ -30,6 +30,7 @@
namespace App\Controller;
use App\Services\GitVersionInfo;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Routing\Annotation\Route;
@ -38,11 +39,12 @@ class HomepageController extends AbstractController
/**
* @Route("/", name="homepage")
*/
public function homepage()
public function homepage(GitVersionInfo $versionInfo)
{
return $this->render('homepage.html.twig',
[
'banner' => $this->getParameter('banner'),
]);
return $this->render('homepage.html.twig', [
'banner' => $this->getParameter('banner'),
'git_branch' => $versionInfo->getGitBranchName(),
'git_commit' => $versionInfo->getGitCommitHash()
]);
}
}