From 25605208e4fbb9e61ac28942b5a623c3a653b5dc Mon Sep 17 00:00:00 2001 From: yusing Date: Thu, 22 Jan 2026 00:18:58 +0800 Subject: [PATCH] fix(config): update JSON tags in ACL and access log configurations to omit empty values Modified JSON tags in the Notify struct of ACL config and the ConfigBase and Retention structs in access log config to include 'omitempty' --- internal/acl/config.go | 6 +++--- internal/logging/accesslog/config.go | 2 +- internal/logging/accesslog/retention.go | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/internal/acl/config.go b/internal/acl/config.go index aff37289..d25ba8d6 100644 --- a/internal/acl/config.go +++ b/internal/acl/config.go @@ -26,9 +26,9 @@ type Config struct { Log *accesslog.ACLLoggerConfig `json:"log"` Notify struct { - To []string `json:"to"` // list of notification providers - Interval time.Duration `json:"interval"` // interval between notifications - IncludeAllowed *bool `json:"include_allowed"` // default: false + To []string `json:"to,omitempty"` // list of notification providers + Interval time.Duration `json:"interval,omitempty"` // interval between notifications + IncludeAllowed *bool `json:"include_allowed,omitzero"` // default: false } `json:"notify"` config diff --git a/internal/logging/accesslog/config.go b/internal/logging/accesslog/config.go index f27a51e0..1200ba2f 100644 --- a/internal/logging/accesslog/config.go +++ b/internal/logging/accesslog/config.go @@ -10,7 +10,7 @@ import ( type ( ConfigBase struct { - Path string `json:"path"` + Path string `json:"path,omitempty"` Stdout bool `json:"stdout"` Retention *Retention `json:"retention" aliases:"keep"` RotateInterval time.Duration `json:"rotate_interval,omitempty" swaggertype:"primitive,integer"` diff --git a/internal/logging/accesslog/retention.go b/internal/logging/accesslog/retention.go index 1658c021..a67cf953 100644 --- a/internal/logging/accesslog/retention.go +++ b/internal/logging/accesslog/retention.go @@ -9,9 +9,9 @@ import ( ) type Retention struct { - Days uint64 `json:"days"` - Last uint64 `json:"last"` - KeepSize uint64 `json:"keep_size"` + Days uint64 `json:"days,omitempty"` + Last uint64 `json:"last,omitempty"` + KeepSize uint64 `json:"keep_size,omitempty"` } // @name LogRetention var (