forked from External/ergo
Rip out REST API and web interface.
It's not really used and I'd rather not have it here unless I'm able to actively maintain it properly and build out the web interface. I might re-add it later but for now I'd rather not have it unless anyone's actively using it.
This commit is contained in:
parent
04d5d2fcc2
commit
f7f049973f
9 changed files with 2 additions and 401 deletions
|
|
@ -7,14 +7,12 @@ package irc
|
|||
|
||||
import (
|
||||
"bufio"
|
||||
"context"
|
||||
"crypto/tls"
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"log"
|
||||
"math/rand"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strconv"
|
||||
|
|
@ -39,14 +37,6 @@ var (
|
|||
couldNotParseIPMsg, _ = (&[]ircmsg.IrcMessage{ircmsg.MakeMessage(nil, "", "ERROR", "Unable to parse your IP address")}[0]).Line()
|
||||
)
|
||||
|
||||
const (
|
||||
// when shutting down the REST server, wait this long
|
||||
// before killing active connections. TODO: this might not be
|
||||
// necessary at all? but it seems prudent to avoid potential resource
|
||||
// leaks
|
||||
httpShutdownTimeout = time.Second
|
||||
)
|
||||
|
||||
// Limits holds the maximum limits for various things such as topic lengths.
|
||||
type Limits struct {
|
||||
AwayLen int
|
||||
|
|
@ -116,8 +106,6 @@ type Server struct {
|
|||
registeredChannelsMutex sync.RWMutex
|
||||
rehashMutex sync.Mutex
|
||||
rehashSignal chan os.Signal
|
||||
restAPI RestAPIConfig
|
||||
restAPIServer *http.Server
|
||||
proxyAllowedFrom []string
|
||||
signals chan os.Signal
|
||||
snomasks *SnoManager
|
||||
|
|
@ -1445,7 +1433,6 @@ func (server *Server) applyConfig(config *Config, initial bool) error {
|
|||
|
||||
// we are now open for business
|
||||
server.setupListeners(config)
|
||||
server.setupRestAPI(config)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
@ -1583,32 +1570,6 @@ func (server *Server) setupListeners(config *Config) {
|
|||
}
|
||||
}
|
||||
|
||||
func (server *Server) setupRestAPI(config *Config) {
|
||||
restAPIEnabled := config.Server.RestAPI.Enabled
|
||||
restAPIStarted := server.restAPIServer != nil
|
||||
restAPIListenAddrChanged := server.restAPI.Listen != config.Server.RestAPI.Listen
|
||||
|
||||
// stop an existing REST server if it's been disabled or the addr changed
|
||||
if restAPIStarted && (!restAPIEnabled || restAPIListenAddrChanged) {
|
||||
ctx, _ := context.WithTimeout(context.Background(), httpShutdownTimeout)
|
||||
server.restAPIServer.Shutdown(ctx)
|
||||
server.restAPIServer.Close()
|
||||
server.logger.Info("rehash", "server", fmt.Sprintf("%s rest API stopped on %s.", server.name, server.restAPI.Listen))
|
||||
server.restAPIServer = nil
|
||||
}
|
||||
|
||||
// start a new one if it's enabled or the addr changed
|
||||
if restAPIEnabled && (!restAPIStarted || restAPIListenAddrChanged) {
|
||||
server.restAPIServer, _ = StartRestAPI(server, config.Server.RestAPI.Listen)
|
||||
server.logger.Info(
|
||||
"rehash", "server",
|
||||
fmt.Sprintf("%s rest API started on %s.", server.name, config.Server.RestAPI.Listen))
|
||||
}
|
||||
|
||||
// save the config information
|
||||
server.restAPI = config.Server.RestAPI
|
||||
}
|
||||
|
||||
func (server *Server) GetDefaultChannelModes() Modes {
|
||||
server.configurableStateMutex.RLock()
|
||||
defer server.configurableStateMutex.RUnlock()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue