compose/server/proxy/proxy.go

21 lines
435 B
Go
Raw Normal View History

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
}