summaryrefslogtreecommitdiff
path: root/opt/auth.sh
diff options
context:
space:
mode:
authorRATDAD <lambda@disroot.org>2025-12-12 01:49:48 -0500
committerRATDAD <lambda@disroot.org>2025-12-12 01:49:48 -0500
commitde8d06726cae205ead43f8b1ac07ecc59a07363b (patch)
tree7b7cf48605040f0f07c618c2b78d7aad927249b6 /opt/auth.sh
parent0c7bf0252aa5b9a2c3a3d95ce84370a3d67cb62b (diff)
downloadcgit-docker-de8d06726cae205ead43f8b1ac07ecc59a07363b.tar.gz
cgit-docker-de8d06726cae205ead43f8b1ac07ecc59a07363b.tar.bz2
cgit-docker-de8d06726cae205ead43f8b1ac07ecc59a07363b.zip
Edited README, omitted /cgit.cgi/ from urls, added HTTP Basic Auth
Diffstat (limited to 'opt/auth.sh')
-rw-r--r--opt/auth.sh10
1 files changed, 10 insertions, 0 deletions
diff --git a/opt/auth.sh b/opt/auth.sh
new file mode 100644
index 0000000..6d87868
--- /dev/null
+++ b/opt/auth.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+# Check if we're enabling basic auth.
+if [ "$HTTP_AUTH_PASSWORD" != "" ]; then
+ echo "AuthType Basic
+AuthName \"CGit\"
+AuthUserFile /srv/www/htdocs/cgit/.htpasswd
+Require valid-user" > /srv/www/htdocs/cgit/.htaccess
+htpasswd -c -b /srv/www/htdocs/cgit/.htpasswd $HTTP_AUTH_USER $HTTP_AUTH_PASSWORD
+fi \ No newline at end of file