mirror of https://github.com/docker/compose.git
21 lines
435 B
Go
21 lines
435 B
Go
package proxy
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/docker/api/client"
|
|
)
|
|
|
|
type clientKey struct{}
|
|
|
|
// WithClient adds the client to the context
|
|
func WithClient(ctx context.Context, c *client.Client) (context.Context, error) {
|
|
return context.WithValue(ctx, clientKey{}, c), nil
|
|
}
|
|
|
|
// Client returns the client from the context
|
|
func Client(ctx context.Context) *client.Client {
|
|
c, _ := ctx.Value(clientKey{}).(*client.Client)
|
|
return c
|
|
}
|