aboutsummaryrefslogtreecommitdiffstats
path: root/services/cgit
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-06-03 17:12:58 +0200
committerThomas Vanbesien <tvanbesi@proton.me>2026-06-03 17:48:25 +0200
commitba3a7bc94421f93818f9196bd8a2c32eb7d9d940 (patch)
tree952392f7cce20e3848caefbf98ec8316894cc1ca /services/cgit
parent9d6c353c5ef82f862ad06ef84b13e65567997201 (diff)
downloadnet_services-ba3a7bc94421f93818f9196bd8a2c32eb7d9d940.tar.gz
net_services-ba3a7bc94421f93818f9196bd8a2c32eb7d9d940.zip
feat: better initialization script
Rename `tools/build` → `net_services` `net_services` can be run from anywhere (previously it was not creating the fs archives in the right place). It also creates the directories specified in `.env`, generate a self-signed certificate if no certificate is available, initialize the first Radicale user if missing, and copy example configuration files if missing for cgit. `generate_self_signed_cert` has been removed (its code is in `net_services`)
Diffstat (limited to 'services/cgit')
-rw-r--r--services/cgit/examples/about.md3
-rw-r--r--services/cgit/examples/cgitrc47
-rwxr-xr-xservices/cgit/examples/commit-filter.sh11
3 files changed, 61 insertions, 0 deletions
diff --git a/services/cgit/examples/about.md b/services/cgit/examples/about.md
new file mode 100644
index 0000000..9aa4532
--- /dev/null
+++ b/services/cgit/examples/about.md
@@ -0,0 +1,3 @@
+# cgit
+
+Edit this in `about.md`.
diff --git a/services/cgit/examples/cgitrc b/services/cgit/examples/cgitrc
new file mode 100644
index 0000000..631feaa
--- /dev/null
+++ b/services/cgit/examples/cgitrc
@@ -0,0 +1,47 @@
+#
+# Global
+#
+css=/cgit.css
+logo=/cgit.png
+# Formatters
+source-filter=/usr/local/lib/cgit/filters/syntax-highlighting.py
+about-filter=/usr/local/lib/cgit/filters/about-formatting.sh
+commit-filter=/usr/local/lib/cgit/filters/commit/commit-filter.sh
+# Mimetypes (for plain blobs)
+mimetype.gif=image/gif
+mimetype.html=text/html
+mimetype.jpg=image/jpeg
+mimetype.jpeg=image/jpeg
+mimetype.pdf=application/pdf
+mimetype.png=image/png
+mimetype.svg=image/svg+xml
+
+#
+# Cache
+#
+cache-size=1000
+
+#
+# Index
+#
+root-title=Edit this in cgitrc
+root-desc=Edit this in cgitrc
+root-readme=/srv/cgit/about.md
+favicon=/favicon.ico
+
+#
+# Repositories
+#
+enable-index-owner=1
+enable-index-links=1
+enable-commit-graph=1
+enable-log-filecount=1
+enable-log-linecount=1
+repository-sort=age
+remove-suffix=1
+max-stats=year
+snapshots=tar.gz zip
+clone-url=http://localhost:8080/$CGIT_REPO_URL
+readme=:readme.md
+# This setting must be set last because settings set after repos are scanned are not applied
+scan-path=/srv/git
diff --git a/services/cgit/examples/commit-filter.sh b/services/cgit/examples/commit-filter.sh
new file mode 100755
index 0000000..3b6dbd2
--- /dev/null
+++ b/services/cgit/examples/commit-filter.sh
@@ -0,0 +1,11 @@
+regex=''
+
+# This expression generates links to commits referenced by their SHA1.
+regex=$regex'
+s|\b([0-9a-fA-F]{7,64})\b|<a href="./?id=\1">\1</a>|g'
+
+# This expression generates links to a fictional bugtracker.
+regex=$regex'
+s|#([0-9]+)\b|<a href="http://bugs.example.com/?bug=\1">#\1</a>|g'
+
+sed -re "$regex"