repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

commit
5775c48
parent
ebcdf13
author
Eric Bower
date
2024-11-28 00:24:46 +0000 UTC
fix(auth): user `server_id` to classify space
1 files changed,  +4, -3
M auth/api.go
+4, -3
 1@@ -607,10 +607,11 @@ type CaddyAccessLog struct {
 2 	Request     AccessLogReq `json:"request"`
 3 	Status      int          `json:"status"`
 4 	RespHeaders RespHeaders  `json:"resp_headers"`
 5+	ServiceID   string       `json:"server_id"`
 6 }
 7 
 8 func deserializeCaddyAccessLog(dbpool db.DB, access *CaddyAccessLog) (*db.AnalyticsVisits, error) {
 9-	spaceRaw := strings.SplitN(access.Request.Tls.ServerName, ".", 2)
10+	spaceRaw := strings.SplitN(access.ServiceID, ".", 2)
11 	space := spaceRaw[0]
12 	host := access.Request.Host
13 	path := access.Request.Uri
14@@ -845,10 +846,10 @@ func StartApiServer() {
15 
16 	ctx := context.Background()
17 
18-	// gather metrics in the auth service
19-	go metricDrainSub(ctx, db, logger, cfg.Secret)
20 	// convert container logs to access logs
21 	go containerDrainSub(ctx, db, logger)
22+	// gather metrics in the auth service
23+	go metricDrainSub(ctx, db, logger, cfg.Secret)
24 
25 	defer ctx.Done()
26