2014-11-06 16:49:04 +00:00
package WebServer
import (
"github.com/SommerEngineering/Ocean/ICCC"
2014-11-07 09:46:33 +00:00
"github.com/SommerEngineering/Ocean/ICCC/SystemMessages"
2014-11-06 16:49:04 +00:00
"github.com/SommerEngineering/Ocean/Log"
LM "github.com/SommerEngineering/Ocean/Log/Meta"
)
func Start ( ) {
2014-11-07 09:46:33 +00:00
// Tell the whole cluster, that we are up and ready:
data := SystemMessages . ICCCStartUpMessage { }
2015-06-17 15:44:52 +00:00
// Start the public web server:
2014-11-07 09:46:33 +00:00
if serverPublic != nil {
data . PublicIPAddressAndPort = serverPublicAddressPort
Log . LogShort ( senderName , LM . CategorySYSTEM , LM . LevelINFO , LM . MessageNameSTARTUP , ` Public web server is now listening. ` , ` Configuration for hostname and port. ` , serverPublicAddressPort )
2014-11-06 16:49:04 +00:00
go serverPublic . ListenAndServe ( )
}
2015-06-17 15:44:52 +00:00
// Start the private web server:
2014-11-06 16:49:04 +00:00
if serverAdmin != nil {
2014-11-07 09:46:33 +00:00
data . AdminIPAddressAndPort = serverAdminAddressPort
Log . LogShort ( senderName , LM . CategorySYSTEM , LM . LevelINFO , LM . MessageNameSTARTUP , ` Admin web server is now listening. ` , ` Configuration for hostname and port. ` , serverAdminAddressPort )
2014-11-06 16:49:04 +00:00
go serverAdmin . ListenAndServe ( )
}
2014-11-07 16:31:21 +00:00
2015-06-17 15:44:52 +00:00
// Notify the whole cluster, that this server is now up and ready:
2014-11-07 16:31:21 +00:00
ICCC . WriteMessage2All ( ICCC . ChannelSYSTEM , ` System::Start ` , data )
2014-11-06 16:49:04 +00:00
}