| Index: luci_config/appengine/format/context.go
|
| diff --git a/luci_config/appengine/format/context.go b/luci_config/appengine/format/context.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..73b7044781dedd7b4e52a3dd0e32df6c2f1e7843
|
| --- /dev/null
|
| +++ b/luci_config/appengine/format/context.go
|
| @@ -0,0 +1,25 @@
|
| +// Copyright 2016 The LUCI Authors. All rights reserved.
|
| +// Use of this source code is governed under the Apache License, Version 2.0
|
| +// that can be found in the LICENSE file.
|
| +
|
| +package format
|
| +
|
| +import (
|
| + "github.com/luci/luci-go/luci_config/server/cfgclient"
|
| +
|
| + "golang.org/x/net/context"
|
| +)
|
| +
|
| +var formatRegistryKey = "github.com/luci/luci-go/luci_config/appengine/format:FormatRegistry"
|
| +
|
| +// WithRegistry returns a Context with the supplied FormatterRegistry embedded
|
| +// into it.
|
| +func WithRegistry(c context.Context, fr *cfgclient.FormatterRegistry) context.Context {
|
| + return context.WithValue(c, &formatRegistryKey, fr)
|
| +}
|
| +
|
| +// GetRegistry is used to retrieve the config service format registry from the
|
| +// supplied Context.
|
| +func GetRegistry(c context.Context) *cfgclient.FormatterRegistry {
|
| + return c.Value(&formatRegistryKey).(*cfgclient.FormatterRegistry)
|
| +}
|
|
|