From a7b73a63cf46c84fce6000b91a88226d374d12b4 Mon Sep 17 00:00:00 2001 From: Gibheer Date: Wed, 21 Aug 2024 17:58:59 +0200 Subject: initial commit --- go.mod | 3 +++ main.go | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 go.mod create mode 100644 main.go diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..47839a6 --- /dev/null +++ b/go.mod @@ -0,0 +1,3 @@ +module gocgi + +go 1.22.5 diff --git a/main.go b/main.go new file mode 100644 index 0000000..e3d8d91 --- /dev/null +++ b/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "log" + "net/http" + "net/http/cgi" +) + +func main() { + forwarder := &cgi.Handler{ + Path: "/usr/lib/cgit/cgit.cgi", + Root: "/", + Env: []string{"CGIT_CONFIG=cgitrc"}, + Dir: "/home/gibheer/projects/", + } + http.Handle("/assets/", http.StripPrefix("/assets", http.FileServer(http.Dir("/usr/share/webapps/cgit/")))) + http.Handle("/", forwarder) + log.Fatalf("server stopped working: %s", http.ListenAndServe(":8080", nil)) +} -- cgit v1.2.3-70-g09d2