feat(v2): modify flux proxy to add org parameter to /api/v2/query

pull/5619/head
Pavel Zavora 2020-11-24 20:24:44 +01:00
parent 6bb9afc296
commit e3270fefb2
1 changed files with 5 additions and 0 deletions

View File

@ -176,6 +176,11 @@ func (s *Service) ProxyFlux(w http.ResponseWriter, r *http.Request) {
director := func(req *http.Request) {
// Set the Host header of the original Flux URL
req.Host = u.Host
// Add v2-required org parameter
query := u.Query()
query.Add("org", src.Username) // v2 organization name is stored as v1 username
u.RawQuery = query.Encode()
// Set URL
req.URL = u
// Use authorization method based on whether it is OSS or Enterprise