Update architecture
All checks were successful
CI/CD / Lint & Test (push) Successful in 48s
CI/CD / Build & Push Docker image (hub.p42.ru) (push) Successful in 2m56s

This commit is contained in:
admin 2026-02-09 17:35:21 +07:00
parent f4f3062352
commit a1bb6e4783
2 changed files with 5 additions and 5 deletions

View File

@ -6,7 +6,7 @@ WORKDIR /app
COPY go.mod go.sum ./ COPY go.mod go.sum ./
RUN go mod download RUN go mod download
COPY main.go index.html favicon.ico ./ COPY main.go index.html favicon.png ./
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o nats-ui main.go RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="-s -w" -o nats-ui main.go
# Runtime stage # Runtime stage

View File

@ -18,7 +18,7 @@ import (
"gopkg.in/yaml.v3" "gopkg.in/yaml.v3"
) )
//go:embed index.html favicon.ico //go:embed index.html favicon.png
var staticFS embed.FS var staticFS embed.FS
var upgrader = websocket.Upgrader{ var upgrader = websocket.Upgrader{
@ -315,7 +315,7 @@ func main() {
}() }()
} }
indexHTML, _ := staticFS.ReadFile("index.html") indexHTML, _ := staticFS.ReadFile("index.html")
faviconICO, _ := staticFS.ReadFile("favicon.ico") faviconPNG, _ := staticFS.ReadFile("favicon.png")
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
switch r.URL.Path { switch r.URL.Path {
@ -324,9 +324,9 @@ func main() {
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
_, _ = w.Write(indexHTML) _, _ = w.Write(indexHTML)
case "/favicon.ico": case "/favicon.ico":
w.Header().Set("Content-Type", "image/x-icon") w.Header().Set("Content-Type", "image/png")
w.WriteHeader(http.StatusOK) w.WriteHeader(http.StatusOK)
_, _ = w.Write(faviconICO) _, _ = w.Write(faviconPNG)
default: default:
http.NotFound(w, r) http.NotFound(w, r)
} }