Omit empty fields from bootstrap config output

probod-bootstrap was writing empty strings and stub blocks such as
`esign: {}` into generated YAML. The post-marshal prune pass caused
part of that by stripping empty leaf strings while leaving empty
parent maps behind.

Drop the prune round-trip in WriteConfig and rely on struct-level
omitzero/omitempty tags plus custom IsZero() helpers on probodconfig.
Only include LLM providers when an API key is set, use a nil map for
extra API headers, and extend the dev-config Makefile recipe with the
local dev defaults already documented in .env.example.

Config loading is unchanged: omitted keys still decode to Go zero
values.

Signed-off-by: Ludovic Vielle <ludovic@probo.com>
This commit is contained in:
Ludovic Vielle
2026-07-01 10:15:28 +02:00
parent 2be3e18437
commit e22aaa8b67
17 changed files with 380 additions and 195 deletions

View File

@@ -35,7 +35,7 @@ type (
// TracingConfig contains tracing configuration.
TracingConfig struct {
Addr string `json:"addr"`
Addr string `json:"addr,omitempty"`
MaxBatchSize int `json:"max-batch-size"`
BatchTimeout int `json:"batch-timeout"`
ExportTimeout int `json:"export-timeout"`
@@ -44,12 +44,12 @@ type (
// ESignConfig contains electronic signature configuration.
ESignConfig struct {
TSAURL string `json:"tsa-url"`
TSAURL string `json:"tsa-url,omitempty"`
}
// Config represents the probod application configuration.
Config struct {
BaseURL string `json:"base-url"`
BaseURL string `json:"base-url,omitempty"`
EncryptionKey string `json:"encryption-key"`
Pg PgConfig `json:"pg"`
Api APIConfig `json:"api"`
@@ -57,7 +57,7 @@ type (
TrustCenter TrustCenterConfig `json:"trust-center"`
AWS AWSConfig `json:"aws"`
Notifications NotificationsConfig `json:"notifications"`
Connectors []ConnectorConfig `json:"connectors"`
Connectors []ConnectorConfig `json:"connectors,omitempty"`
Agents AgentsConfig `json:"llm"`
EvidenceDescriber EvidenceDescriberConfig `json:"evidence-describer"`
ThirdPartyVetting ThirdPartyVettingWorkerConfig `json:"third-party-vetting-worker"`
@@ -66,17 +66,17 @@ type (
CommonPatternEnrichmentWorker CommonPatternEnrichmentWorkerConfig `json:"common-pattern-enrichment-worker"`
CommonThirdPartyEnrichmentWorker CommonThirdPartyEnrichmentWorkerConfig `json:"common-third-party-enrichment-worker"`
ChromeDPAddr string `json:"chrome-dp-addr"`
ChromeDPAddr string `json:"chrome-dp-addr,omitempty"`
CustomDomains CustomDomainsConfig `json:"custom-domains"`
SCIMBridge SCIMBridgeConfig `json:"scim-bridge"`
ESign ESignConfig `json:"esign"`
ESign ESignConfig `json:"esign,omitzero"`
Branding bool `json:"branding"`
}
// TrustCenterConfig contains trust center server configuration.
TrustCenterConfig struct {
HTTPAddr string `json:"http-addr"`
HTTPSAddr string `json:"https-addr"`
ProxyProtocol ProxyProtocolConfig `json:"proxy-protocol"`
HTTPAddr string `json:"http-addr,omitempty"`
HTTPSAddr string `json:"https-addr,omitempty"`
ProxyProtocol ProxyProtocolConfig `json:"proxy-protocol,omitzero"`
}
)