mirror of
https://codeberg.org/git-pages/git-pages.git
synced 2026-05-14 11:11:35 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7170e3077 | ||
|
|
7f5e02081d | ||
|
|
59cf185143 |
@@ -1,6 +1,9 @@
|
||||
git-pages
|
||||
=========
|
||||
|
||||
<a href="ircs://irc.libera.chat/#git-pages"><img alt="Discuss on IRC at #git-pages on libera.chat" src="https://img.shields.io/badge/irc-libera.chat-blue"></a>
|
||||
<a href="https://matrix.to/#/#git-pages:catircservices.org"><img alt="Discuss on Matrix at #git-pages:catircservices.org" src="https://img.shields.io/matrix/git-pages%3Acatircservices.org?server_fqdn=matrix.org&fetchMode=summary&label=matrix&color=blue"></a>
|
||||
|
||||
_git-pages_ is a static site server for use with Git forges (i.e. a GitHub Pages replacement). It is written with efficiency in mind, scaling horizontally to any number of machines and serving sites up to multiple gigabytes in size, while being equally suitable for small single-user deployments.
|
||||
|
||||
It is implemented in Go and has no other mandatory dependencies, although it is designed to be used together with the [Caddy server][caddy] for TLS termination. Site data may be stored on the filesystem or in an [Amazon S3](https://aws.amazon.com/s3/) compatible object store.
|
||||
|
||||
@@ -328,6 +328,10 @@ func Main(versionInfo string) {
|
||||
logc.Fatalln(ctx, err)
|
||||
}
|
||||
|
||||
if domainCache, err = CreateDomainCache(ctx); err != nil {
|
||||
logc.Fatalln(ctx, err)
|
||||
}
|
||||
|
||||
// The server has its own logic for creating the backend.
|
||||
if cliOperations > 0 {
|
||||
if backend, err = CreateBackend(ctx, &config.Storage); err != nil {
|
||||
@@ -654,10 +658,6 @@ func Main(versionInfo string) {
|
||||
}
|
||||
backend = NewObservedBackend(backend)
|
||||
|
||||
if domainCache, err = CreateDomainCache(ctx); err != nil {
|
||||
logc.Fatalln(ctx, err)
|
||||
}
|
||||
|
||||
middleware := chainHTTPMiddleware(
|
||||
panicHandler,
|
||||
remoteAddrMiddleware,
|
||||
|
||||
@@ -846,14 +846,13 @@ func ServePages(w http.ResponseWriter, r *http.Request) {
|
||||
if config.Audit.IncludeIPs != "" {
|
||||
GetPrincipal(r.Context()).IpAddress = proto.String(r.RemoteAddr)
|
||||
}
|
||||
var mediaType string
|
||||
switch r.Method {
|
||||
case "HEAD", "GET":
|
||||
mediaType = r.Header.Get("Accept")
|
||||
case "PUT", "PATCH", "POST":
|
||||
mediaType := r.Header.Get("Content-Type")
|
||||
logc.Println(r.Context(), "pages:", r.Method, r.Host, r.URL, mediaType)
|
||||
default:
|
||||
mediaType = r.Header.Get("Content-Type")
|
||||
logc.Println(r.Context(), "pages:", r.Method, r.Host, r.URL)
|
||||
}
|
||||
logc.Println(r.Context(), "pages:", r.Method, r.Host, r.URL, mediaType)
|
||||
if hostname, err := os.Hostname(); err == nil {
|
||||
if region := os.Getenv("PAGES_REGION"); region != "" {
|
||||
w.Header().Add("Server", fmt.Sprintf("git-pages (%s; %s)", region, hostname))
|
||||
|
||||
Reference in New Issue
Block a user