| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. |
| 4 |
| 5 package format |
| 6 |
| 7 import ( |
| 8 "github.com/luci/luci-go/luci_config/server/cfgclient" |
| 9 |
| 10 "golang.org/x/net/context" |
| 11 ) |
| 12 |
| 13 var formatRegistryKey = "github.com/luci/luci-go/luci_config/appengine/format:Fo
rmatRegistry" |
| 14 |
| 15 // WithRegistry returns a Context with the supplied FormatterRegistry embedded |
| 16 // into it. |
| 17 func WithRegistry(c context.Context, fr *cfgclient.FormatterRegistry) context.Co
ntext { |
| 18 return context.WithValue(c, &formatRegistryKey, fr) |
| 19 } |
| 20 |
| 21 // GetRegistry is used to retrieve the config service format registry from the |
| 22 // supplied Context. |
| 23 func GetRegistry(c context.Context) *cfgclient.FormatterRegistry { |
| 24 return c.Value(&formatRegistryKey).(*cfgclient.FormatterRegistry) |
| 25 } |
| OLD | NEW |