summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortjpcc <tjp@ctrl-c.club>2023-09-17 18:39:02 -0600
committertjpcc <tjp@ctrl-c.club>2023-09-17 18:39:02 -0600
commit8b6ec37932c72e41c66d82337748dc75eba57f25 (patch)
tree02a2cd3414c2ea3980a5eca327f7f0c54039f01e
parentb8cd694a2d4e4f12caa413b0407c2b7a7f836d45 (diff)
add syw and gemini and gopher routers at /git/
-rw-r--r--config.go5
-rw-r--r--go.mod7
-rw-r--r--go.sum6
-rw-r--r--routes.go9
4 files changed, 25 insertions, 2 deletions
diff --git a/config.go b/config.go
index 4eb6dbc..7160c19 100644
--- a/config.go
+++ b/config.go
@@ -18,6 +18,9 @@ type config struct {
geminiRoot string
gopherRoot string
+ geminiRepos string
+ gopherRepos string
+
tlsKeyFile string
tlsCertFile string
@@ -49,6 +52,8 @@ func configure() config {
hostname: os.Getenv("HOST_NAME"),
geminiRoot: os.Getenv("GEMINI_ROOT"),
gopherRoot: os.Getenv("GOPHER_ROOT"),
+ geminiRepos: os.Getenv("GEMINI_REPOS"),
+ gopherRepos: os.Getenv("GOPHER_REPOS"),
tlsKeyFile: os.Getenv("TLS_KEY_FILE"),
tlsCertFile: os.Getenv("TLS_CERT_FILE"),
diff --git a/go.mod b/go.mod
index 260e9cb..6956efa 100644
--- a/go.mod
+++ b/go.mod
@@ -1,8 +1,11 @@
module tildegit.org/tjp/sr-71
-go 1.19
+go 1.21.0
-require tildegit.org/tjp/sliderule v1.3.3
+require (
+ tildegit.org/tjp/sliderule v1.3.3
+ tildegit.org/tjp/syw v0.9.0
+)
require (
github.com/go-kit/log v0.2.1 // indirect
diff --git a/go.sum b/go.sum
index 2f61174..6ed5849 100644
--- a/go.sum
+++ b/go.sum
@@ -1,10 +1,16 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
+github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
tildegit.org/tjp/sliderule v1.3.3 h1:K4yXKtJqnxbD65HNIu36cWmc0ThK5GywBAM6Yilsutk=
tildegit.org/tjp/sliderule v1.3.3/go.mod h1:opdo8E25iS9X9pNismM8U7pCH8XO0PdRIIhdADn8Uik=
+tildegit.org/tjp/syw v0.9.0 h1:4b9p7NZJaTEGdiyFh+YXrRcvqgHTpTa9RwbqFQoD9NY=
+tildegit.org/tjp/syw v0.9.0/go.mod h1:sgeQ5WZybBioHjXb0W0Fco4jTjF3+wrJvS3Pytgzjac=
diff --git a/routes.go b/routes.go
index 08d2c56..83f2868 100644
--- a/routes.go
+++ b/routes.go
@@ -19,6 +19,7 @@ import (
"tildegit.org/tjp/sliderule/gemini/gemtext/atomconv"
"tildegit.org/tjp/sliderule/gopher/gophermap"
"tildegit.org/tjp/sliderule/logging"
+ "tildegit.org/tjp/syw"
)
func geminiRouter(conf config) sr.Handler {
@@ -58,6 +59,10 @@ func geminiRouter(conf config) sr.Handler {
)),
)
+ if conf.geminiRepos != "" {
+ router.Mount("/git", syw.GeminiRouter(conf.geminiRepos, nil))
+ }
+
h := router.Handler()
if conf.geminiAutoAtom {
h = atomconv.Auto(h)
@@ -92,6 +97,10 @@ func gopherRouter(conf config) sr.Handler {
cgi.GopherCGIDirectory("/cgi-bin/", filepath.Join(conf.gopherRoot, "cgi-bin"), &settings),
)
+ if conf.gopherRepos != "" {
+ router.Mount("/git", syw.GopherRouter(conf.gopherRepos, nil))
+ }
+
return router.Handler()
}