github.com/blend/go-sdk@v1.20220411.3/configutil/context.go (about) 1 /* 2 3 Copyright (c) 2022 - Present. Blend Labs, Inc. All rights reserved 4 Use of this source code is governed by a MIT license that can be found in the LICENSE file. 5 6 */ 7 8 package configutil 9 10 import ( 11 "context" 12 ) 13 14 type configFilePathsKey struct{} 15 16 // WithConfigPaths adds config file paths to the context. 17 func WithConfigPaths(ctx context.Context, paths []string) context.Context { 18 return context.WithValue(ctx, configFilePathsKey{}, paths) 19 } 20 21 // GetConfigPaths gets the config file paths from a context.. 22 func GetConfigPaths(ctx context.Context) []string { 23 if raw := ctx.Value(configFilePathsKey{}); raw != nil { 24 if typed, ok := raw.([]string); ok { 25 return typed 26 } 27 } 28 return nil 29 }