mirror of
https://github.com/opentofu/opentofu.git
synced 2025-02-25 18:45:20 -06:00
Update atlas-go to latest version that uses go-rootcerts
This commit is contained in:
parent
4ac6dda633
commit
c44062814c
8
Godeps/Godeps.json
generated
8
Godeps/Godeps.json
generated
@ -673,13 +673,13 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/hashicorp/atlas-go/archive",
|
"ImportPath": "github.com/hashicorp/atlas-go/archive",
|
||||||
"Comment": "20141209094003-90-g0008886",
|
"Comment": "20141209094003-92-g95fa852",
|
||||||
"Rev": "0008886ebfa3b424bed03e2a5cbe4a2568ea0ff6"
|
"Rev": "95fa852edca41c06c4ce526af4bb7dec4eaad434"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/hashicorp/atlas-go/v1",
|
"ImportPath": "github.com/hashicorp/atlas-go/v1",
|
||||||
"Comment": "20141209094003-90-g0008886",
|
"Comment": "20141209094003-92-g95fa852",
|
||||||
"Rev": "0008886ebfa3b424bed03e2a5cbe4a2568ea0ff6"
|
"Rev": "95fa852edca41c06c4ce526af4bb7dec4eaad434"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/hashicorp/consul/api",
|
"ImportPath": "github.com/hashicorp/consul/api",
|
||||||
|
21
vendor/github.com/hashicorp/atlas-go/v1/client.go
generated
vendored
21
vendor/github.com/hashicorp/atlas-go/v1/client.go
generated
vendored
@ -2,6 +2,7 @@ package atlas
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"crypto/tls"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
@ -14,6 +15,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/hashicorp/go-cleanhttp"
|
"github.com/hashicorp/go-cleanhttp"
|
||||||
|
"github.com/hashicorp/go-rootcerts"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -24,6 +26,14 @@ const (
|
|||||||
// default Atlas address.
|
// default Atlas address.
|
||||||
atlasEndpointEnvVar = "ATLAS_ADDRESS"
|
atlasEndpointEnvVar = "ATLAS_ADDRESS"
|
||||||
|
|
||||||
|
// atlasCAFileEnvVar is the environment variable that causes the client to
|
||||||
|
// load trusted certs from a file
|
||||||
|
atlasCAFileEnvVar = "ATLAS_CAFILE"
|
||||||
|
|
||||||
|
// atlasCAPathEnvVar is the environment variable that causes the client to
|
||||||
|
// load trusted certs from a directory
|
||||||
|
atlasCAPathEnvVar = "ATLAS_CAPATH"
|
||||||
|
|
||||||
// atlasTokenHeader is the header key used for authenticating with Atlas
|
// atlasTokenHeader is the header key used for authenticating with Atlas
|
||||||
atlasTokenHeader = "X-Atlas-Token"
|
atlasTokenHeader = "X-Atlas-Token"
|
||||||
)
|
)
|
||||||
@ -112,6 +122,17 @@ func NewClient(urlString string) (*Client, error) {
|
|||||||
// init() sets defaults on the client.
|
// init() sets defaults on the client.
|
||||||
func (c *Client) init() error {
|
func (c *Client) init() error {
|
||||||
c.HTTPClient = cleanhttp.DefaultClient()
|
c.HTTPClient = cleanhttp.DefaultClient()
|
||||||
|
tlsConfig := &tls.Config{}
|
||||||
|
err := rootcerts.ConfigureTLS(tlsConfig, &rootcerts.Config{
|
||||||
|
CAFile: os.Getenv(atlasCAFileEnvVar),
|
||||||
|
CAPath: os.Getenv(atlasCAPathEnvVar),
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
t := cleanhttp.DefaultTransport()
|
||||||
|
t.TLSClientConfig = tlsConfig
|
||||||
|
c.HTTPClient.Transport = t
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user