mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-06-04 11:25:52 +08:00

* feat(keys): add support for multiple ingestion keys * ci(git): remove vendor/ from git * feat(gateway): create a proxy for sending requests to the gateway * fix(sqlite): remove keys schema * fix(api): replace with constant * fix(server): remove redundant options * fix(server): remove redundant options * test(gateway): add unit tests for gateway proxy * ci(docker): update gateway url * refactor(gateway): move gateway to api layer * fix(manager): fix declared error in manager * feat(testing): add a new testing docker-compose * fix(license): revert to nil license since select will never return a norows error * feat(gateway): add feature flags * chore(server): add a logger --------- Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
35 lines
782 B
Go
35 lines
782 B
Go
package api
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
|
|
"go.signoz.io/signoz/ee/query-service/integrations/gateway"
|
|
)
|
|
|
|
func (ah *APIHandler) ServeGatewayHTTP(rw http.ResponseWriter, req *http.Request) {
|
|
ctx := req.Context()
|
|
if !strings.HasPrefix(req.URL.Path, gateway.RoutePrefix+gateway.AllowedPrefix) {
|
|
rw.WriteHeader(http.StatusNotFound)
|
|
return
|
|
}
|
|
|
|
license, err := ah.LM().GetRepo().GetActiveLicense(ctx)
|
|
if err != nil {
|
|
RespondError(rw, err, nil)
|
|
return
|
|
}
|
|
|
|
//Create headers
|
|
var licenseKey string
|
|
if license != nil {
|
|
licenseKey = license.Key
|
|
}
|
|
|
|
req.Header.Set("X-Signoz-Cloud-Api-Key", licenseKey)
|
|
req.Header.Set("X-Consumer-Username", "lid:00000000-0000-0000-0000-000000000000")
|
|
req.Header.Set("X-Consumer-Groups", "ns:default")
|
|
|
|
ah.Gateway().ServeHTTP(rw, req)
|
|
}
|