diff --git a/ingest/router.go b/ingest/router.go index de395d2..5d1ba29 100644 --- a/ingest/router.go +++ b/ingest/router.go @@ -171,7 +171,7 @@ func (r *Router) CorsMiddleware(c *gin.Context) { if c.Request.Method == "OPTIONS" { c.Header("Access-Control-Allow-Origin", utils.NvlString(origin, "*")) c.Header("Access-Control-Allow-Methods", "GET,POST,HEAD,OPTIONS") - c.Header("Access-Control-Allow-Headers", "x-enable-debug, x-write-key, authorization, content-type") + c.Header("Access-Control-Allow-Headers", "x-enable-debug, x-write-key, authorization, content-type, x-ip-policy") c.Header("Access-Control-Allow-Credentials", "true") c.Header("Access-Control-Max-Age", "86400") c.AbortWithStatus(http.StatusOK) @@ -179,7 +179,7 @@ func (r *Router) CorsMiddleware(c *gin.Context) { } else if origin != "" { c.Header("Access-Control-Allow-Origin", origin) c.Header("Access-Control-Allow-Methods", "GET,POST,HEAD,OPTIONS") - c.Header("Access-Control-Allow-Headers", "x-enable-debug, x-write-key, authorization, content-type") + c.Header("Access-Control-Allow-Headers", "x-enable-debug, x-write-key, authorization, content-type, x-ip-policy") c.Header("Access-Control-Allow-Credentials", "true") c.Header("Access-Control-Max-Age", "86400") } diff --git a/sync-sidecar/db/db.go b/sync-sidecar/db/db.go index 85d07db..307ff20 100644 --- a/sync-sidecar/db/db.go +++ b/sync-sidecar/db/db.go @@ -10,8 +10,8 @@ const ( upsertSpecSQL = `INSERT INTO source_spec as s (package, version, specs, timestamp, error ) VALUES ($1, $2, $3, $4, $5) ON CONFLICT ON CONSTRAINT source_spec_pkey DO UPDATE SET specs = $3, timestamp = $4, error=$5 where s.specs is null` - insertSpecErrorSQL = `INSERT INTO source_spec (package, version, timestamp, error ) VALUES ($1, $2, $3, $4) -ON CONFLICT ON CONSTRAINT source_spec_pkey DO NOTHING` + insertSpecErrorSQL = `INSERT INTO source_spec as s (package, version, timestamp, error ) VALUES ($1, $2, $3, $4) +ON CONFLICT ON CONSTRAINT source_spec_pkey DO UPDATE SET timestamp = $3, error=$4 where s.specs is null` upsertCatalogStatusSQL = `INSERT INTO source_catalog (package, version, key, timestamp, status, description) VALUES ($1, $2, $3, $4, $5, $6) ON CONFLICT ON CONSTRAINT source_catalog_pkey DO UPDATE SET timestamp = $4, status=$5, description=$6`