MCPcopy
hub / github.com/revel/revel / InitServerEngine

Function InitServerEngine

server.go:96–134  ·  view source on GitHub ↗

Build an engine initialization object and start the engine.

(port int, serverEngine string)

Source from the content-addressed store, hash-verified

94
95// Build an engine initialization object and start the engine.
96func InitServerEngine(port int, serverEngine string) {
97 address := HTTPAddr
98 if address == "" {
99 address = "localhost"
100 }
101 if port == 0 {
102 port = HTTPPort
103 }
104
105 var (
106 network = "tcp"
107 localAddress string
108 )
109
110 // If the port is zero, treat the address as a fully qualified local address.
111 // This address must be prefixed with the network type followed by a colon,
112 // e.g. unix:/tmp/app.socket or tcp6:::1 (equivalent to tcp6:0:0:0:0:0:0:0:1)
113 if port == 0 {
114 parts := strings.SplitN(address, ":", 2)
115 network = parts[0]
116 localAddress = parts[1]
117 } else {
118 localAddress = address + ":" + strconv.Itoa(port)
119 }
120
121 if engineLoader, ok := serverEngineMap[serverEngine]; !ok {
122 panic("Server Engine " + serverEngine + " Not found")
123 } else {
124 CurrentEngine = engineLoader()
125 serverLogger.Debug("InitServerEngine: Found server engine and invoking", "name", CurrentEngine.Name())
126 ServerEngineInit = &EngineInit{
127 Address: localAddress,
128 Network: network,
129 Port: port,
130 Callback: handleInternal,
131 }
132 }
133 AddInitEventHandler(CurrentEngine.Event)
134}
135
136// Initialize the controller stack for the application.
137func initControllerStack() {

Callers 2

RunFunction · 0.85
startFakeBookingAppFunction · 0.85

Calls 3

AddInitEventHandlerFunction · 0.85
DebugMethod · 0.80
NameMethod · 0.65

Tested by 1

startFakeBookingAppFunction · 0.68