Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy Support #2133

Merged
merged 1 commit into from
Oct 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions azurerm/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,19 @@ func (c *ArmClient) configureClient(client *autorest.Client, auth autorest.Autho
setUserAgent(client)
client.Authorizer = auth
//client.RequestInspector = azure.WithClientID(clientRequestID())
client.Sender = autorest.CreateSender(withRequestLogging())
client.Sender = buildSender()
client.SkipResourceProviderRegistration = c.skipProviderRegistration
client.PollingDuration = 60 * time.Minute
}

func buildSender() autorest.Sender {
tombuildsstuff marked this conversation as resolved.
Show resolved Hide resolved
return autorest.DecorateSender(&http.Client{
Transport: &http.Transport{
Proxy: http.ProxyFromEnvironment,
},
}, withRequestLogging())
}

func withRequestLogging() autorest.SendDecorator {
return func(s autorest.Sender) autorest.Sender {
return autorest.SenderFunc(func(r *http.Request) (*http.Response, error) {
Expand Down Expand Up @@ -451,7 +459,7 @@ func getArmClient(c *authentication.Config) (*ArmClient, error) {
return nil, fmt.Errorf("Unable to configure OAuthConfig for tenant %s", c.TenantID)
}

sender := autorest.CreateSender(withRequestLogging())
sender := buildSender()

// Resource Manager endpoints
endpoint := env.ResourceManagerEndpoint
Expand Down