support json schema

This commit is contained in:
2025-03-22 14:02:39 -04:00
parent f0a699029a
commit 3e319b24fd
10 changed files with 82 additions and 36 deletions

View File

@ -11,16 +11,16 @@ var DefaultConfig = &AppConfig{
}
type AppConfig struct {
Name string `yaml:"name,omitempty" env:"APP_NAME"`
Environment string `yaml:"environment,omitempty" env:"APP_ENVIRONMENT"`
Name string `yaml:"name,omitempty" env:"APP_NAME" json:"name,omitempty"`
Environment string `yaml:"environment,omitempty" env:"APP_ENVIRONMENT" json:"environment,omitempty"`
// 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)
Version string `yaml:"version,omitempty" env:"APP_VERSION"`
Logging *LogConfig `yaml:"logging,omitempty"`
HTTP *HTTPConfig `yaml:"http,omitempty"`
OTEL *OTELConfig `yaml:"otel,omitempty"`
GRPC *GRPCConfig `yaml:"grpc,omitempty"`
Version string `yaml:"version,omitempty" env:"APP_VERSION" json:"version,omitempty"`
Logging *LogConfig `yaml:"logging,omitempty" json:"logging,omitempty"`
HTTP *HTTPConfig `yaml:"http,omitempty" json:"http,omitempty"`
OTEL *OTELConfig `yaml:"otel,omitempty" json:"otel,omitempty"`
GRPC *GRPCConfig `yaml:"grpc,omitempty" json:"grpc,omitempty"`
}
func (ac *AppConfig) HTTPEnabled() bool {