Implements CONSOLE_DEV_MODE env var (#2517)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
This commit is contained in:
@@ -272,3 +272,7 @@ func getMaxConcurrentDownloadsLimit() int64 {
|
||||
|
||||
return cu
|
||||
}
|
||||
|
||||
func getConsoleDevMode() bool {
|
||||
return strings.ToLower(env.Get(ConsoleDevMode, "off")) == "on"
|
||||
}
|
||||
|
||||
@@ -53,6 +53,7 @@ const (
|
||||
ConsoleLogQueryAuthToken = "CONSOLE_LOG_QUERY_AUTH_TOKEN"
|
||||
ConsoleMaxConcurrentUploads = "CONSOLE_MAX_CONCURRENT_UPLOADS"
|
||||
ConsoleMaxConcurrentDownloads = "CONSOLE_MAX_CONCURRENT_DOWNLOADS"
|
||||
ConsoleDevMode = "CONSOLE_DEV_MODE"
|
||||
LogSearchQueryAuthToken = "LOGSEARCH_QUERY_AUTH_TOKEN"
|
||||
SlashSeparator = "/"
|
||||
)
|
||||
|
||||
@@ -148,10 +148,12 @@ func serveWS(w http.ResponseWriter, req *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
// Un-comment for development so websockets work on port 5005
|
||||
/*upgrader.CheckOrigin = func(r *http.Request) bool {
|
||||
return true
|
||||
}*/
|
||||
// Development mode validation
|
||||
if getConsoleDevMode() {
|
||||
upgrader.CheckOrigin = func(r *http.Request) bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
// upgrades the HTTP server connection to the WebSocket protocol.
|
||||
conn, err := upgrader.Upgrade(w, req, nil)
|
||||
|
||||
Reference in New Issue
Block a user