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