mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-12 19:32:48 -06:00
346aa964e8
This change brings in support for multiple bundles to be downloaded and activated OPA. This is enabled by using the new config option `bundles` to define the bundles, and deprecates the older `bundle` option. The new `bundles` keyword and structure is propagated through to the decision logs, status API, provenance, stored manifests, etc. Check out the doc changes for all the updated structures. That being said any existing configuration using `bundle` will *not* see the new structure, everything is intended to be backwards compatible (almost to a fault). Fixes: #721 Signed-off-by: Patrick East <east.patrick@gmail.com>
24 lines
565 B
Go
24 lines
565 B
Go
// Copyright 2018 The OPA Authors. All rights reserved.
|
|
// Use of this source code is governed by an Apache2
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package util
|
|
|
|
import (
|
|
"io"
|
|
"io/ioutil"
|
|
"net/http"
|
|
)
|
|
|
|
// Close reads the remaining bytes from the response and then closes it to
|
|
// ensure that the connection is freed. If the body is not read and closed, a
|
|
// leak can occur.
|
|
func Close(resp *http.Response) {
|
|
if resp != nil && resp.Body != nil {
|
|
if _, err := io.Copy(ioutil.Discard, resp.Body); err != nil {
|
|
return
|
|
}
|
|
resp.Body.Close()
|
|
}
|
|
}
|