github.com/blend/go-sdk@v1.20220411.3/configmeta/doc.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 configmeta provides a configutil metadata type to provide a canonical location to hold common config variables. 9 10 It provides a couple common variables to set with ldflags on build, namely `configmeta.Version` and `configmeta.GitRef`. 11 12 These can be set at build time with `go install -ldflags="-X github.com/blend/go-sdk/configmeta.Version=$(cat ${REPO_ROOT}/VERSION)" project/myapp` as an example. 13 14 The typical usage for the configmeta.Meta type is to embed in a config type and resolve it in your resolver. 15 16 Config Example: 17 18 type Config struct { 19 configmeta.Meta `yaml:",inline"` 20 } 21 22 // Resolve resolves the config. 23 func (c *Config) Resolve(ctx context.Context) error { 24 return configutil.Resolve(ctx, 25 (&c.Meta).Resolve, 26 ) 27 } 28 29 This will pull `SERVICE_NAME` and `SERVICE_ENV` into relevant fields, as well as `configmeta.Version` into the Version field. 30 31 This type is used in a number of other packages for common fields like service name and service environment. 32 */ 33 package configmeta // import "github.com/blend/go-sdk/configmeta"