c572fcfe04
Rename the Go module path from code.gitea.io/gitea to git.mokoconsulting.tech/MokoConsulting/MokoGitea across the entire codebase. Scope: - go.mod module declaration - 2,235 Go source files (import paths) - Dockerfile WORKDIR and COPY paths - Swagger API templates - golangci.yml linter config External dependencies (code.gitea.io/gitea-vet, code.gitea.io/sdk/gitea, gitea.com/gitea/act, etc.) are intentionally NOT renamed — they are separate upstream modules. Closes #132 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
50 lines
1.6 KiB
Go
50 lines
1.6 KiB
Go
// Copyright 2016 The Gitea Authors. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package cmd
|
|
|
|
import (
|
|
"net"
|
|
"net/http"
|
|
"net/http/fcgi"
|
|
"strings"
|
|
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/graceful"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/log"
|
|
"git.mokoconsulting.tech/MokoConsulting/MokoGitea/modules/setting"
|
|
)
|
|
|
|
func runHTTP(network, listenAddr, name string, m http.Handler, useProxyProtocol bool) error {
|
|
return graceful.HTTPListenAndServe(network, listenAddr, name, m, useProxyProtocol)
|
|
}
|
|
|
|
// NoHTTPRedirector tells our cleanup routine that we will not be using a fallback http redirector
|
|
func NoHTTPRedirector() {
|
|
graceful.GetManager().InformCleanup()
|
|
}
|
|
|
|
// NoInstallListener tells our cleanup routine that we will not be using a possibly provided listener
|
|
// for our install HTTP/HTTPS service
|
|
func NoInstallListener() {
|
|
graceful.GetManager().InformCleanup()
|
|
}
|
|
|
|
func runFCGI(network, listenAddr, name string, m http.Handler, useProxyProtocol bool) error {
|
|
// This needs to handle stdin as fcgi point
|
|
fcgiServer := graceful.NewServer(network, listenAddr, name)
|
|
|
|
err := fcgiServer.ListenAndServe(func(listener net.Listener) error {
|
|
return fcgi.Serve(listener, http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
|
|
if setting.AppSubURL != "" {
|
|
req.URL.Path = strings.TrimPrefix(req.URL.Path, setting.AppSubURL)
|
|
}
|
|
m.ServeHTTP(resp, req)
|
|
}))
|
|
}, useProxyProtocol)
|
|
if err != nil {
|
|
log.Fatal("Failed to start FCGI main server: %v", err)
|
|
}
|
|
log.Info("FCGI Listener: %s Closed", listenAddr)
|
|
return err
|
|
}
|