diff --git a/.gitignore b/.gitignore index 2dc1fd4..87e6a75 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ FactBanSync composite-banlist.json data/logs data/banCache/ +data/server.crt +data/server.key diff --git a/glob.go b/glob.go index 5b3611b..1ceb294 100644 --- a/glob.go +++ b/glob.go @@ -6,7 +6,7 @@ import ( "time" ) -const ProgVersion string = "0.0.208" +const ProgVersion string = "0.0.209" // Globals var ( diff --git a/main.go b/main.go index 1122d40..ff24e61 100644 --- a/main.go +++ b/main.go @@ -3,6 +3,8 @@ package main import ( "flag" "log" + "os" + "time" ) func main() { @@ -61,5 +63,34 @@ func main() { startWebserver() + go func() { + for { + time.Sleep(time.Second * 5) + + initialStat, erra := os.Stat(serverConfig.WebServer.SSLCertFile) + + if erra != nil { + continue + } + + for initialStat != nil { + time.Sleep(time.Second * 5) + + stat, errb := os.Stat(serverConfig.WebServer.SSLCertFile) + if errb != nil { + break + } + + if stat.Size() != initialStat.Size() || stat.ModTime() != initialStat.ModTime() { + log.Println("Cert updated, closing.") + time.Sleep(time.Second * 5) + os.Exit(0) + break + } + } + + } + }() + mainLoop() }