Compare commits

..

No commits in common. "c8822b9e330933e5a807b37399705a2fd92afca3" and "e8ec5009c885f7dc4c7d5fb466d2d36fae0fce6e" have entirely different histories.

4 changed files with 4 additions and 9 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,7 +5,6 @@ package configuration
import (
"fmt"
"log"
"os"
"git.kle.li/tools/go-import-redirector/pkg/configuration/file"
@ -25,6 +24,8 @@ 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)
@ -66,7 +67,6 @@ 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,7 +5,6 @@ package packagelist
import (
"fmt"
"log"
"net/http"
"strings"
@ -135,7 +134,6 @@ 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{}{
@ -157,6 +155,7 @@ 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,21 +44,17 @@ 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 {