feat(fastapi): add configurable commit hash display

Two new options have been added:

- [devel] commit_url
    - URL including an %s format specifier that can be used to link
      to a webpage for the commit.
- [devel] commit_hash
    - HEAD's commit hash (produced via `git rev-parse HEAD`)

If a `[devel] commit_hash` is configured, a link to the commit based on
`[devel] commit_url` will be displayed in the aurweb footer in
the form: `HEAD@<commit_hash>`. If no `[devel] commit_url` is
configured, a non-linked hash will be displayed.

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-10-24 18:07:56 -07:00
parent da55aa6491
commit 0d734eb07d
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
6 changed files with 82 additions and 1 deletions

View file

@ -104,3 +104,15 @@ server = ftp://mirrors.kernel.org/archlinux/%s/os/x86_64
packagesfile = /srv/http/aurweb/web/html/packages.gz
pkgbasefile = /srv/http/aurweb/web/html/pkgbase.gz
userfile = /srv/http/aurweb/web/html/users.gz
[devel]
; commit_url is a format string used to produce a link to a commit hash.
commit_url = https://gitlab.archlinux.org/archlinux/aurweb/-/commits/%s
; If commit_hash is configured, a link to the commit based on commit_url
; will be displayed in aurweb's footer with the release version.
; This allows us to diagnose which commit a particular instance is on
; during testing of development branches.
; Example deployment configuration step:
; sed -r "s/^;?(commit_hash) =.*$/\1 = $(git rev-parse HEAD)/" config
;commit_hash = 1234567

View file

@ -62,3 +62,6 @@ bind_address = 127.0.0.1:8082
; Passphrase FastAPI uses to sign client-side sessions.
session_secret = secret
[devel]
;commit_hash = 1234567