Skip to content

Commit

Permalink
sync upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
yandex-cloud-bot committed Dec 20, 2024
1 parent 6c3760d commit 2393e24
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 7 deletions.
6 changes: 3 additions & 3 deletions credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ func ServiceAccountKey(key *iamkey.Key) (Credentials, error) {
// You can override the default address of Metadata Service by setting env variable.
// TODO(skipor): doc link
func InstanceServiceAccount() NonExchangeableCredentials {
return newInstanceServiceAccountCredentials(getMetadataServiceAddr())
return newInstanceServiceAccountCredentials(GetMetadataServiceAddr())
}

// getMetadataServiceAddr returns the address of Metadata Service, gets the value from InstanceMetadataOverrideEnvVar
// GetMetadataServiceAddr returns the address of Metadata Service, gets the value from InstanceMetadataOverrideEnvVar
// env variable if it is set, otherwise uses the default address from InstanceMetadataAddr.
func getMetadataServiceAddr() string {
func GetMetadataServiceAddr() string {
if nonDefaultAddr := os.Getenv(InstanceMetadataOverrideEnvVar); nonDefaultAddr != "" {
return nonDefaultAddr
}
Expand Down
6 changes: 3 additions & 3 deletions credentials_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"testing"
"time"

jwt "github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v4"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

Expand Down Expand Up @@ -123,7 +123,7 @@ func TestMetadataServiceOverride(t *testing.T) {
// GIVEN
expected := InstanceMetadataAddr
// WHEN
actual := getMetadataServiceAddr()
actual := GetMetadataServiceAddr()
// THEN
require.Equal(t, expected, actual)
})
Expand All @@ -132,7 +132,7 @@ func TestMetadataServiceOverride(t *testing.T) {
expected := "69.69.69.69"
require.NoError(t, os.Setenv(InstanceMetadataOverrideEnvVar, expected))
// WHEN
actual := getMetadataServiceAddr()
actual := GetMetadataServiceAddr()
// THEN
require.Equal(t, expected, actual)
require.NoError(t, os.Unsetenv(InstanceMetadataOverrideEnvVar))
Expand Down
9 changes: 9 additions & 0 deletions gen/lockboxpayload/payload.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/hashicorp/go-multierror v1.1.1
github.com/mitchellh/go-testing-interface v1.14.1
github.com/stretchr/testify v1.9.0
github.com/yandex-cloud/go-genproto v0.0.0-20241206133605-07e4a676108b
github.com/yandex-cloud/go-genproto v0.0.0-20241220122821-aeb3b05efd1c
golang.org/x/net v0.28.0
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1
google.golang.org/grpc v1.66.2
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ github.com/yandex-cloud/go-genproto v0.0.0-20241202160409-e71211db0fd5 h1:tkw7yV
github.com/yandex-cloud/go-genproto v0.0.0-20241202160409-e71211db0fd5/go.mod h1:0LDD/IZLIUIV4iPH+YcF+jysO3jkSvADFGm4dCAuwQo=
github.com/yandex-cloud/go-genproto v0.0.0-20241206133605-07e4a676108b h1:+xsB23dmxN3hBSGZLAiyLsUADnqr6ASOiZJmLd8++nk=
github.com/yandex-cloud/go-genproto v0.0.0-20241206133605-07e4a676108b/go.mod h1:0LDD/IZLIUIV4iPH+YcF+jysO3jkSvADFGm4dCAuwQo=
github.com/yandex-cloud/go-genproto v0.0.0-20241220122821-aeb3b05efd1c h1:Rnr+lDYXVkP+3eT8/d68iq4G/UeIhyCQk+HKa8toTvg=
github.com/yandex-cloud/go-genproto v0.0.0-20241220122821-aeb3b05efd1c/go.mod h1:0LDD/IZLIUIV4iPH+YcF+jysO3jkSvADFGm4dCAuwQo=
golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE=
golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg=
golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg=
Expand Down

0 comments on commit 2393e24

Please sign in to comment.