mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-03 08:28:31 +00:00
Post to backend when server start
This commit is contained in:
parent
95a8f710f8
commit
a4bac68d02
3 changed files with 19 additions and 2 deletions
|
@ -48,12 +48,13 @@ func main() {
|
|||
if err != nil {
|
||||
log.Fatal("Could not create logfile: ", err)
|
||||
}
|
||||
log.SetOutput(logFile)
|
||||
|
||||
server.SetupServerAndHandle(conf, nil)
|
||||
|
||||
go commandLineConsole()
|
||||
|
||||
log.SetOutput(logFile)
|
||||
|
||||
if conf.UseSSL {
|
||||
err = httpServer.ListenAndServeTLS(conf.SSLCertificateFile, conf.SSLKeyFile)
|
||||
} else {
|
||||
|
|
|
@ -26,6 +26,7 @@ var responseCache *cache.Cache
|
|||
var getBacklogUrl string
|
||||
var postStatisticsUrl string
|
||||
var addTopicUrl string
|
||||
var announceStartupUrl string
|
||||
|
||||
var backendSharedKey [32]byte
|
||||
var serverId int
|
||||
|
@ -43,6 +44,7 @@ func SetupBackend(config *ConfigFile) {
|
|||
getBacklogUrl = fmt.Sprintf("%s/backlog", backendUrl)
|
||||
postStatisticsUrl = fmt.Sprintf("%s/stats", backendUrl)
|
||||
addTopicUrl = fmt.Sprintf("%s/topics", backendUrl)
|
||||
announceStartupUrl = fmt.Sprintf("%s/startup", backendUrl)
|
||||
|
||||
messageBufferPool.New = New4KByteBuffer
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import (
|
|||
"io/ioutil"
|
||||
"log"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strconv"
|
||||
"strings"
|
||||
"sync"
|
||||
|
@ -92,7 +93,7 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
|
|||
|
||||
bannerBytes, err := ioutil.ReadFile("index.html")
|
||||
if err != nil {
|
||||
log.Fatal("Could not open index.html", err)
|
||||
log.Fatalln("Could not open index.html:", err)
|
||||
}
|
||||
BannerHTML = bannerBytes
|
||||
|
||||
|
@ -101,6 +102,19 @@ func SetupServerAndHandle(config *ConfigFile, serveMux *http.ServeMux) {
|
|||
serveMux.HandleFunc("/dump_backlog", HBackendDumpBacklog)
|
||||
serveMux.HandleFunc("/update_and_pub", HBackendUpdateAndPublish)
|
||||
|
||||
announceForm, err := SealRequest(url.Values{
|
||||
"startup": []string{"1"},
|
||||
})
|
||||
if err != nil {
|
||||
log.Fatalln("Unable to seal requests:", err)
|
||||
}
|
||||
resp, err := backendHttpClient.PostForm(announceStartupUrl, announceForm)
|
||||
if err != nil {
|
||||
log.Println(err)
|
||||
} else {
|
||||
resp.Body.Close()
|
||||
}
|
||||
|
||||
go pubsubJanitor()
|
||||
go backlogJanitor()
|
||||
go authorizationJanitor()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue