Remove Webpack dev servers for Boards/Playbooks (#23378)

* Add option to run web app build without dev servers

* Completely remove product dev servers

* Update unit test

* Fix another test
Этот коммит содержится в:
Harrison Healey
2023-05-15 16:18:10 -04:00
коммит произвёл GitHub
родитель e1a2443f1a
Коммит 4cbf6e93d2
7 изменённых файлов: 32 добавлений и 127 удалений

Просмотреть файл

@@ -8,7 +8,6 @@ import (
"context"
"fmt"
"net/http"
"os"
"reflect"
"runtime"
"strconv"
@@ -132,25 +131,6 @@ func generateDevCSP(c Context) string {
}
}
// Add flags for Webpack dev servers used by other products during development
if model.BuildNumber == "dev" {
boardsURL := os.Getenv("MM_BOARDS_DEV_SERVER_URL")
if boardsURL == "" {
// Focalboard runs on http://localhost:9006 by default
boardsURL = "http://localhost:9006"
}
devCSP = append(devCSP, boardsURL)
playbooksURL := os.Getenv("MM_PLAYBOOKS_DEV_SERVER_URL")
if playbooksURL == "" {
// Playbooks runs on http://localhost:9007 by default
playbooksURL = "http://localhost:9007"
}
devCSP = append(devCSP, playbooksURL)
}
if len(devCSP) == 0 {
return ""
}

Просмотреть файл

@@ -449,7 +449,7 @@ func TestHandlerServeCSPHeader(t *testing.T) {
response := httptest.NewRecorder()
handler.ServeHTTP(response, request)
assert.Equal(t, 200, response.Code)
assert.Equal(t, []string{"frame-ancestors 'self'; script-src 'self' cdn.rudderlabs.com js.stripe.com/v3 'unsafe-eval' 'unsafe-inline' http://localhost:9006 http://localhost:9007"}, response.Header()["Content-Security-Policy"])
assert.Equal(t, []string{"frame-ancestors 'self'; script-src 'self' cdn.rudderlabs.com js.stripe.com/v3 'unsafe-eval' 'unsafe-inline'"}, response.Header()["Content-Security-Policy"])
})
}
@@ -472,7 +472,7 @@ func TestGenerateDevCSP(t *testing.T) {
devCSP := generateDevCSP(*c)
assert.Equal(t, " 'unsafe-eval' 'unsafe-inline' http://localhost:9006 http://localhost:9007", devCSP)
assert.Equal(t, " 'unsafe-eval' 'unsafe-inline'", devCSP)
})
t.Run("allowed dev flags", func(t *testing.T) {