🔧 Update Go version in go.mod and enhance build process with versioning information. Modify Makefile and Taskfile to inject build metadata (version, commit, build time) into the binary. Improve README with instructions for custom version builds and document new build info features. Add benchmarks for message parsing and processing to improve performance testing capabilities.

This commit is contained in:
windyboy
2025-11-18 14:15:58 +08:00
parent 7f44b5389d
commit 06fc9cb9e0
27 changed files with 3009 additions and 55 deletions
+24 -2
View File
@@ -35,11 +35,32 @@ type NATSConfig struct {
Consumer string `koanf:"consumer"`
StreamLimits StreamLimitsConfig `koanf:"stream_limits"`
ConsumerRules ConsumerRulesConfig `koanf:"consumer_rules"`
Auth NATSAuthConfig `koanf:"auth"`
// Legacy fields
Client string `koanf:"client"`
Cluster string `koanf:"cluster"`
}
// NATSAuthConfig holds NATS authentication configuration
type NATSAuthConfig struct {
// Token authentication (mutually exclusive with User/Password and CredentialsFile)
Token string `koanf:"token"`
// Credentials file authentication (mutually exclusive with Token and User/Password)
// Path to NATS credentials file (e.g., /path/to/user.creds)
CredentialsFile string `koanf:"credentials_file"`
// User/Password authentication (mutually exclusive with Token and CredentialsFile)
User string `koanf:"user"`
Password string `koanf:"password"`
// TLS configuration
TLSEnabled bool `koanf:"tls_enabled"`
TLSCertFile string `koanf:"tls_cert_file"` // Client certificate file
TLSKeyFile string `koanf:"tls_key_file"` // Client private key file
TLSCAFile string `koanf:"tls_ca_file"` // CA certificate file for server verification
}
// StreamLimitsConfig defines JetStream retention controls.
type StreamLimitsConfig struct {
MaxMsgs int64 `koanf:"max_msgs"`
@@ -173,8 +194,9 @@ func LoadConfig() (*Config, error) {
return strings.ToLower(strings.ReplaceAll(s, "_", "."))
})
if err := k.Load(envProvider, nil); err != nil {
// Environment variables are optional, so we don't fail if they're not present
// This allows the config to work with just the file
// Environment variables are optional, so we don't fail if they're not present.
// This allows the config to work with just the file.
_ = err // explicitly ignore
}
// Unmarshal into Config struct