feat: make TLS optional in Barkfile schema
All checks were successful
Test and Release Module / test (push) Successful in 21s
Test and Release Module / release (push) Successful in 12s

This commit is contained in:
2026-09-15 21:59:48 -04:00
parent 1851797a3f
commit c3ad476b1a
3 changed files with 52 additions and 7 deletions

View File

@@ -21,11 +21,10 @@ func (c Config) Validate() error {
} else if err := validateListenAddress(c.Listen); err != nil {
errs = append(errs, fmt.Errorf("listen address %q: %w", c.Listen, err))
}
if strings.TrimSpace(c.TLS.CertFile) == "" {
errs = append(errs, errors.New("TLS certificate is required"))
}
if strings.TrimSpace(c.TLS.KeyFile) == "" {
errs = append(errs, errors.New("TLS private key is required"))
certificateSet := strings.TrimSpace(c.TLS.CertFile) != ""
keySet := strings.TrimSpace(c.TLS.KeyFile) != ""
if certificateSet != keySet {
errs = append(errs, errors.New("tls requires both cert and key"))
}
if len(c.Databases) == 0 {
errs = append(errs, errors.New("at least one database route is required"))