You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 4, 2018. It is now read-only.
Copy file name to clipboardExpand all lines: main.go
+32-10Lines changed: 32 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -175,15 +175,37 @@ func NewHub() *Hub {
175
175
funcmain() {
176
176
sseString:=os.Getenv("SSE_HOST")
177
177
ifsseString=="" {
178
-
log.Fatal("SSE_HOST is not set, example: SSE_HOST=localhost:3000")
178
+
log.Fatal("SSE_HOST is not set, example: SSE_HOST=localhost:3000 for non SSL or SSE_HOST=localhost:3001 for SSL. Please set SSL_KEY and SSL_CERT to full path of priv key and cert")
179
179
}
180
-
log.Println("[Info] botbot-eventsource is listening on "+sseString)
181
-
182
-
log.Println("[Info] Starting the eventsource Hub")
183
-
h:=NewHub()
184
-
185
-
// eventsource endpoints
186
-
http.HandleFunc(ssePath, h.EventSourceHandler)
187
-
188
-
log.Fatalln(http.ListenAndServe(sseString, nil))
180
+
ifsseString~="3000" {
181
+
182
+
log.Println("[Info] botbot-eventsource is listening on "+sseString)
183
+
184
+
log.Println("[Info] Starting the eventsource Hub")
185
+
h:=NewHub()
186
+
187
+
// eventsource endpoints
188
+
http.HandleFunc(ssePath, h.EventSourceHandler)
189
+
190
+
log.Fatalln(http.ListenAndServe(sseString, nil))
191
+
}
192
+
elseifsslKey=="" {
193
+
log.Fatal("SSL_KEY is not set, set it to full path to key file")
194
+
}
195
+
elseifsslCert=="" {
196
+
log.Fatal("SSL_CERT is not set, set it to full path to cert file")
197
+
}
198
+
else {
199
+
sslKey:=os.Getenv("SSL_KEY")
200
+
sslCert:=os.Getenv("SSL_CERT")
201
+
202
+
log.Println("[Info] botbot-eventsource is listening on "+sseString)
203
+
204
+
log.Println("[Info] Starting the eventsource Hub")
0 commit comments