func GetMailer(ctx context.Context) mailer.Mailer {
	obj := ctx.Value(mailerKey)
	if obj == nil {
		return nil
	}
	return obj.(mailer.Mailer)
}
GetMailer reads the mailer from the context.
package context
import (
	"fmt"
	"context"
	"github.com/dgrijalva/jwt-go"
	"github.com/jinzhu/gorm"
	"github.com/netlify/gocommerce/assetstores"
	"github.com/netlify/gocommerce/claims"
	"github.com/netlify/gocommerce/conf"
	"github.com/netlify/gocommerce/coupons"
	"github.com/netlify/gocommerce/mailer"
	"github.com/netlify/gocommerce/models"
	"github.com/netlify/gocommerce/payments"
)
type contextKey string
func (c contextKey) String() string {
	return "api context key " + string(c)
}
const (
	tokenKey           = contextKey("jwt")
	configKey          = contextKey("config")
	couponsKey         = contextKey("coupons")
	requestIDKey       = contextKey("request_id")
	adminFlagKey       = contextKey("is_admin")
	mailerKey          = contextKey("mailer")
	assetStoreKey      = contextKey("asset_store")
	paymentProviderKey = contextKey("payment-provider")
	userIDKey          = contextKey("user_id")
	userKey            = contextKey("user")
	orderIDKey         = contextKey("order_id")
	instanceIDKey      = contextKey("instance_id")
	instanceKey        = contextKey("instance")
	dbKey              = contextKey("db")
)
func WithConfig(ctx context.Context, config *conf.Configuration) context.Context {
	return context.WithValue(ctx, configKey, config)
}
func GetConfig(ctx context.Context) *conf.Configuration {
	obj := ctx.Value(configKey)
	if obj == nil {
		return nil
	}
	return obj.(*conf.Configuration)
}
func WithCoupons(ctx context.Context, config *conf.Configuration) (context.Context, error) {
	cache, err := coupons.NewCouponCacheFromURL(config)
	if err != nil {
		return nil, err
	}
	return context.WithValue(ctx, couponsKey, cache), nil
}
func GetCoupons(ctx context.Context) coupons.Cache {
	obj := ctx.Value(couponsKey)
	if obj == nil {
		return nil
	}
	return obj.(coupons.Cache)
}
func WithToken(ctx context.Context, token *jwt.Token) context.Context {
	return context.WithValue(ctx, tokenKey, token)
}
func GetToken(ctx context.Context) *jwt.Token {
	obj := ctx.Value(tokenKey)
	if obj == nil {
		return nil
	}
	return obj.(*jwt.Token)
}
func WithRequestID(ctx context.Context, id string) context.Context {
	return context.WithValue(ctx, requestIDKey, id)
}
func GetRequestID(ctx context.Context) string {
	obj := ctx.Value(requestIDKey)
	if obj == nil {
		return ""
	}
	return obj.(string)
}
func WithMailer(ctx context.Context, mailer mailer.Mailer) context.Context {
	return context.WithValue(ctx, mailerKey, mailer)
}