Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Menu
Open sidebar
Lepo
netlify-deployer
Commits
11a6df19
Commit
11a6df19
authored
Nov 07, 2020
by
Jaakko Pallari
🌜
Browse files
Proper context nesting
parent
a35cd278
Changes
1
Hide whitespace changes
Inline
Side-by-side
main.go
View file @
11a6df19
package
main
import
(
"context"
"fmt"
oapiclient
"github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/kelseyhightower/envconfig"
netlify
"github.com/netlify/open-api/go/porcelain"
"github.com/netlify/open-api/go/porcelain/context"
ooapicontext
"github.com/netlify/open-api/go/porcelain/context"
"github.com/sirupsen/logrus"
)
...
...
@@ -86,10 +87,9 @@ func setupNetlifyClient(c *config) *netlify.Netlify {
return
netlify
.
NewHTTPClient
(
formats
)
}
func
setupContext
(
c
*
config
,
logger
*
logrus
.
Logger
)
context
.
Context
{
var
ctx
context
.
Context
ctx
=
context
.
WithLogger
(
ctx
,
logger
.
WithFields
(
logrus
.
Fields
{
func
setupContext
(
c
*
config
,
logger
*
logrus
.
Logger
)
ooapicontext
.
Context
{
ctx
:=
ooapicontext
.
WithLogger
(
context
.
Background
(),
logger
.
WithFields
(
logrus
.
Fields
{
"source"
:
"netlify"
,
}))
return
context
.
WithAuthInfo
(
ctx
,
oapiclient
.
BearerToken
(
c
.
AuthToken
))
return
ooapi
context
.
WithAuthInfo
(
ctx
,
oapiclient
.
BearerToken
(
c
.
AuthToken
))
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment