restapi: Initial commit

This commit is contained in:
Daniel Oaks
2016-11-06 11:05:29 +10:00
parent 4402e3e3aa
commit ee3853f845
6 changed files with 110 additions and 0 deletions
+8
View File
@@ -100,6 +100,7 @@ type Server struct {
passwords *PasswordManager
rehashMutex sync.Mutex
rehashSignal chan os.Signal
restAPI *RestAPIConfig
signals chan os.Signal
store buntdb.DB
whoWas *WhoWasList
@@ -183,6 +184,7 @@ func NewServer(configFilename string, config *Config) *Server {
operators: opers,
signals: make(chan os.Signal, len(ServerExitSignals)),
rehashSignal: make(chan os.Signal, 1),
restAPI: &config.Server.RestAPI,
whoWas: NewWhoWasList(config.Limits.WhowasEntries),
checkIdent: config.Server.CheckIdent,
}
@@ -260,6 +262,12 @@ func NewServer(configFilename string, config *Config) *Server {
server.setISupport()
// start API if enabled
if server.restAPI.Enabled {
Log.info.Printf("%s rest API started on %s .", server.name, server.restAPI.Listen)
server.startRestAPI()
}
return server
}