Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/git/vole.git

Write over SSH with a registered key:

git clone ssh://git@0.0.0.0:2222/vole.git

A free and open-source forge that lives in your Git repo.

Publish repositories as Go modules and move the module path to rodent.software

d37d301fd4881ee37855387377db5a7aed843017 · Keenan Nemetz · 17h ago · parent 1c363d53

Publish repositories as Go modules and move the module path to rodent.software

The module named a GitHub repository that does not exist, and a module path
under the forge could not be fetched anyway: the go command resolves an import
path by asking it for a go-import tag first, and the forge served only pages.

Answer the <host>/<repository> discovery probe from the catch-all route with the
repository's tag, naming its Git transport and that prefix, so a public
repository is importable with no vanity service in front of the instance. Only
a repository an anonymous reader can read answers: the tag is fetched without
credentials, so a tag for a private repository would confirm its existence to
anyone who guessed the name. The prefix host comes from public_url, never the
request's Host header, for the same reason the clone URL does.

With the path resolvable, rename the module to rodent.software/vole: imports,
the build line in the getting-started guide, and the packaged units and
metadata follow it. docs/go-modules.md explains the lookup, what the instance
must have, and why a repository named after a route cannot claim the prefix.

server/web/web.go +21−14

@@ -20,18 +20,18 @@ import (
20 20 "sync"
21 21 "time"
22 22
23 "github.com/rodent-software/vole/ci/logs"
24 "github.com/rodent-software/vole/ci/runs"
25 "github.com/rodent-software/vole/core/lfs"
26 "github.com/rodent-software/vole/forge/access"
27 "github.com/rodent-software/vole/forge/config"
28 "github.com/rodent-software/vole/forge/identity"
29 "github.com/rodent-software/vole/forge/index"
30 "github.com/rodent-software/vole/forge/instancerepo"
31 "github.com/rodent-software/vole/forge/pageview"
32 "github.com/rodent-software/vole/forge/repo"
33 "github.com/rodent-software/vole/forge/secret"
34 "github.com/rodent-software/vole/forge/session"
23 "rodent.software/vole/ci/logs"
24 "rodent.software/vole/ci/runs"
25 "rodent.software/vole/core/lfs"
26 "rodent.software/vole/forge/access"
27 "rodent.software/vole/forge/config"
28 "rodent.software/vole/forge/identity"
29 "rodent.software/vole/forge/index"
30 "rodent.software/vole/forge/instancerepo"
31 "rodent.software/vole/forge/pageview"
32 "rodent.software/vole/forge/repo"
33 "rodent.software/vole/forge/secret"
34 "rodent.software/vole/forge/session"
35 35 )
36 36
37 37 type Web struct {
@@ -157,8 +157,15 @@ func (w *Web) notFound(rw http.ResponseWriter, r *http.Request) {
157 157 }{w.page(r, "Not found"), "That page does not exist, or you do not have access to it."}, http.StatusNotFound)
158 158 }
159 159
160 // NotFoundPage is the catch-all route. It uses the same view as every other 404.
161 func (w *Web) NotFoundPage(rw http.ResponseWriter, r *http.Request) { w.notFound(rw, r) }
160 // NotFoundPage is the catch-all route. A Go module lookup arrives here, because
161 // <host>/<repository> is a module path rather than a page the forge serves; the
162 // discovery probe is answered before the path falls through to the styled 404.
163 func (w *Web) NotFoundPage(rw http.ResponseWriter, r *http.Request) {
164 if w.goModuleMeta(rw, r) {
165 return
166 }
167 w.notFound(rw, r)
168 }
162 169
163 170 // loggablePath is a request path with any secret in it removed. An enrollment
164 171 // link used to carry its token as a path segment, and a log is read by far more