go-app/pkg/config/types.go

25 lines
889 B
Go
Raw Normal View History

2025-01-04 12:24:42 -05:00
package config
2025-01-05 13:09:59 -05:00
// Default Settings
var DefaultConfig = &AppConfig{
Environment: "development",
Version: getVersion(),
2025-03-06 17:16:27 -05:00
Logging: defaultLoggingConfig,
HTTP: defaultHTTPConfig,
OTEL: defaultOTELConfig,
GRPC: defaultGRPCConfig,
2025-01-04 12:24:42 -05:00
}
type AppConfig struct {
2025-01-05 13:09:59 -05:00
Name string `yaml:"name,omitempty" env:"APP_NAME"`
Environment string `yaml:"environment,omitempty" env:"APP_ENVIRONMENT"`
2025-01-04 12:24:42 -05:00
// This should either be set by ldflags, such as with
// go build -ldflags "-X gitea.libretechconsulting.com/rmcguire/go-app/pkg/config.Version=$(VERSION)"
// or allow this to use build meta. Will default to (devel)
2025-01-05 13:09:59 -05:00
Version string `yaml:"version,omitempty" env:"APP_VERSION"`
Logging *LogConfig `yaml:"logging,omitempty"`
HTTP *HTTPConfig `yaml:"http,omitempty"`
OTEL *OTELConfig `yaml:"otel,omitempty"`
2025-03-06 17:16:27 -05:00
GRPC *GRPCConfig `yaml:"grpc,omitempty"`
2025-01-04 12:24:42 -05:00
}