X-Git-Url: http://www.git.cypherpunks.ru/?a=blobdiff_plain;ds=sidebyside;f=gocheese.go;h=fa3b4302f3770b1836be22a26d423ff6144a5d53;hb=cb667e2472867666fe1d87059e00078797e182f6;hp=6ca3ad53e036236ea7dc3310e74d55641f715bbb;hpb=5ccea4614d3d499a0b183998230778e4adfc6127;p=gocheese.git diff --git a/gocheese.go b/gocheese.go index 6ca3ad5..fa3b430 100644 --- a/gocheese.go +++ b/gocheese.go @@ -31,10 +31,12 @@ import ( "net/http" "net/url" "os" + "os/signal" "path/filepath" "regexp" "runtime" "strings" + "syscall" ) const ( @@ -462,6 +464,13 @@ func main() { } refreshPasswd() log.Println("root:", *root, "bind:", *bind) + needsRefreshPasswd := make(chan os.Signal, 0) + signal.Notify(needsRefreshPasswd, syscall.SIGHUP) + go func() { + for range needsRefreshPasswd { + refreshPasswd() + } + }() http.HandleFunc(*norefreshURLPath, handler) http.HandleFunc(*refreshURLPath, handler) log.Fatal(http.ListenAndServe(*bind, nil))