Skip to content

Commit cdbda37

Browse files
committed
Display version information in test application
1 parent 2f9acc4 commit cdbda37

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

app/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ RUN composer install --no-dev --no-scripts; \
2424
composer dump-autoload --optimize --classmap-authoritative; \
2525
bin/console cache:warmup; \
2626
chown -R www-data:www-data ./var/; \
27-
chown -R www-data:www-data ./data/
27+
chown -R www-data:www-data ./data; \
28+
echo "VERSION_COMMIT_ID=$(git rev-parse HEAD)" >> .env \
29+
date +"VERSION_DATE=\"%Y-%m-%d %H:%M:%S\"" >> .env

app/config/packages/twig.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,9 @@
1111
],
1212
'debug' => '%kernel.debug%',
1313
'strict_variables' => '%kernel.debug%',
14+
'globals' => [
15+
'VERSION_COMMIT_ID' => '%env(default::VERSION_COMMIT_ID)%',
16+
'VERSION_DATE' => '%env(default::VERSION_DATE)%',
17+
],
1418
]);
1519
};

app/templates/base.html.twig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,10 @@
2424
<main>
2525
{% block body %}{% endblock %}
2626
</main>
27+
{% if VERSION_COMMIT_ID %}
28+
<footer>
29+
Version: <a href="https://github.com/scheb/2fa/commit/{{ VERSION_COMMIT_ID }}">{{ VERSION_COMMIT_ID|slice(0, 7) }}</a>, Build: {{ VERSION_DATE }}
30+
</footer>
31+
{% endif %}
2732
</body>
2833
</html>

0 commit comments

Comments
 (0)