Skip to content

Commit

Permalink
chore: exposes types (#3461)
Browse files Browse the repository at this point in the history
  • Loading branch information
amir20 authored Dec 16, 2024
1 parent 6479bbb commit d02fbae
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ RUN go mod download

# Copy all other files
COPY internal ./internal
COPY types ./types
COPY main.go ./
COPY protos ./protos
COPY shared_key.pem shared_cert.pem ./
Expand Down
3 changes: 2 additions & 1 deletion internal/analytics/http_beacon.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import (
"net/http"
"net/http/httputil"

"github.com/amir20/dozzle/types"
"github.com/rs/zerolog/log"
)

func SendBeacon(e BeaconEvent) error {
func SendBeacon(e types.BeaconEvent) error {
log.Trace().Interface("event", e).Msg("sending beacon")
jsonValue, err := json.Marshal(e)
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion internal/support/cli/analytics.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,15 @@ package cli
import (
"github.com/amir20/dozzle/internal/analytics"
"github.com/amir20/dozzle/internal/docker"
"github.com/amir20/dozzle/types"
"github.com/rs/zerolog/log"
)

func StartEvent(args Args, mode string, client docker.Client, subCommand string) {
if args.NoAnalytics {
return
}
event := analytics.BeaconEvent{
event := types.BeaconEvent{
Name: "start",
Version: args.Version(),
Mode: mode,
Expand Down
3 changes: 2 additions & 1 deletion internal/web/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/amir20/dozzle/internal/docker"
docker_support "github.com/amir20/dozzle/internal/support/docker"
support_web "github.com/amir20/dozzle/internal/support/web"
"github.com/amir20/dozzle/types"
"github.com/rs/zerolog/log"
)

Expand Down Expand Up @@ -111,7 +112,7 @@ func sendBeaconEvent(h *handler, r *http.Request, runningContainers int) {
if h.config.NoAnalytics {
return
}
b := analytics.BeaconEvent{
b := types.BeaconEvent{
AuthProvider: string(h.config.Authorization.Provider),
Browser: r.Header.Get("User-Agent"),
Clients: h.multiHostService.TotalClients(),
Expand Down
2 changes: 1 addition & 1 deletion internal/analytics/types.go → types/types.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package analytics
package types

type BeaconEvent struct {
Name string `json:"name"`
Expand Down

0 comments on commit d02fbae

Please sign in to comment.