Skip to content
This repository has been archived by the owner on Mar 1, 2024. It is now read-only.

Commit

Permalink
Add better logging options
Browse files Browse the repository at this point in the history
  • Loading branch information
DAlperin committed Sep 6, 2022
1 parent 1e09180 commit 8bbfe3d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,16 @@ func (p *provider) Configure(ctx context.Context, req tfsdkprovider.ConfigureReq
resp.Diagnostics.AddWarning("Debug mode enabled", "Debug mode enabled, this will add the Fly-Force-Trace header to all graphql requests")
}

// hclient := hreq.C().DevMode()
hclient := hreq.C()
p.httpClient = hclient

p.httpClient.SetCommonHeader("Authorization", "Bearer "+p.token)
p.httpClient.SetTimeout(2 * time.Minute)
p.httpClient = hreq.C()

if enableTracing {
p.httpClient.SetCommonHeader("Fly-Force-Trace", "true")
p.httpClient = hreq.C().DevMode()
}

p.httpClient.SetCommonHeader("Authorization", "Bearer "+p.token)
p.httpClient.SetTimeout(2 * time.Minute)

// TODO: Make timeout configurable
h := http.Client{Timeout: 60 * time.Second, Transport: &utils.Transport{UnderlyingTransport: http.DefaultTransport, Token: token, Ctx: ctx, EnableDebugTrace: enableTracing}}
client := graphql.NewClient("https://api.fly.io/graphql", &h)
Expand Down

0 comments on commit 8bbfe3d

Please sign in to comment.