Compare commits

...

2 Commits

Author SHA1 Message Date
gapodo c8822b9e33 try reduced build
ci/woodpecker/push/build Pipeline was successful Details
2023-12-26 22:45:39 +01:00
gapodo 4124e626f4 add some logging 2023-12-26 22:43:27 +01:00
4 changed files with 9 additions and 4 deletions

View File

@ -182,7 +182,7 @@ release-sources: | $(DIST_DIRS)
rm -f $(STORED_VERSION_FILE)
.PHONY: release ## Prepare a full release
release: build-linux release-copy release-compress vendor release-sources release-check
release: build-linux # release-copy release-compress vendor release-sources release-check
.PHONY: dockerize
dockerize: | $(DIST_DIRS)

View File

@ -5,6 +5,7 @@ package configuration
import (
"fmt"
"log"
"os"
"git.kle.li/tools/go-import-redirector/pkg/configuration/file"
@ -24,8 +25,6 @@ func New(cfgFile string, hotReload bool, reloadFunction func()) *Configuration {
v: viper.New(),
}
c.v.Debug()
if cfgFile != "" {
// Use Configurationfile from the flag.
c.v.SetConfigFile(cfgFile)
@ -67,6 +66,7 @@ func New(cfgFile string, hotReload bool, reloadFunction func()) *Configuration {
}
func (c *Configuration) updateConfig(_ fsnotify.Event) {
log.Println("Hot reload triggered")
c.loadCfgFile()
if c.r != nil {

View File

@ -5,6 +5,7 @@ package packagelist
import (
"fmt"
"log"
"net/http"
"strings"
@ -134,6 +135,7 @@ func (pl *PackageList) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
log.Println("Path is " + r.URL.Path)
if r.URL.Path == "/" {
if pkg, ok := pl.GetMostSpecificPackage(""); ok {
err := indexTmpl.Execute(w, map[string]interface{}{
@ -155,7 +157,6 @@ func (pl *PackageList) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
return
}
fmt.Println("Path is " + r.URL.Path)
if pkg, ok := pl.GetMostSpecificPackage(r.URL.Path); ok {
err := pkgTmpl.Execute(w, map[string]interface{}{
"pkg": pkg,

View File

@ -44,17 +44,21 @@ func (s *Server) startHTTPServer() {
}
func (s *Server) Restart(pkgs *packagelist.PackageList) {
log.Println("started reloading config")
s.Shutdown()
s.Start(pkgs)
log.Println("server restarted")
}
func (s *Server) Start(pkgs *packagelist.PackageList) {
log.Println("Starting server")
s.pkgs = pkgs
s.wg.Add(1)
s.startHTTPServer()
}
func (s *Server) Shutdown() {
log.Println("Stopping server")
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
if err := s.srv.Shutdown(ctx); err != nil {