diff --git a/awssmfs/awssm.go b/awssmfs/awssm.go index d88581f8..1a0ef366 100644 --- a/awssmfs/awssm.go +++ b/awssmfs/awssm.go @@ -140,7 +140,16 @@ func (f *awssmFS) getClient(ctx context.Context) (SecretsManagerClient, error) { return nil, err } - f.smclient = secretsmanager.NewFromConfig(cfg) + optFns := []func(*secretsmanager.Options){} + + // setting a host in the URL is only intended for test purposes + if f.base.Host != "" { + optFns = append(optFns, func(o *secretsmanager.Options) { + o.BaseEndpoint = aws.String("http://" + f.base.Host) + }) + } + + f.smclient = secretsmanager.NewFromConfig(cfg, optFns...) return f.smclient, nil } diff --git a/awssmpfs/awssmp.go b/awssmpfs/awssmp.go index 130bd2e1..4e8a78e0 100644 --- a/awssmpfs/awssmp.go +++ b/awssmpfs/awssmp.go @@ -140,25 +140,21 @@ func (f *awssmpFS) getClient(ctx context.Context) (SSMClient, error) { opts = append(opts, config.WithHTTPClient(f.httpclient)) } - // setting a host in the URL is only intended for test purposes - if f.base.Host != "" { - customResolver := aws.EndpointResolverWithOptionsFunc(func(_, _ string, _ ...interface{}) (aws.Endpoint, error) { - return aws.Endpoint{ - PartitionID: "aws", - URL: "http://" + f.base.Host, - SigningRegion: "us-east-1", - }, nil - }) - - opts = append(opts, config.WithEndpointResolverWithOptions(customResolver)) - } - cfg, err := config.LoadDefaultConfig(ctx, opts...) if err != nil { return nil, err } - f.ssmclient = ssm.NewFromConfig(cfg) + optFns := []func(*ssm.Options){} + + // setting a host in the URL is only intended for test purposes + if f.base.Host != "" { + optFns = append(optFns, func(o *ssm.Options) { + o.BaseEndpoint = aws.String("http://" + f.base.Host) + }) + } + + f.ssmclient = ssm.NewFromConfig(cfg, optFns...) return f.ssmclient, nil }