natsio/config.go

55 lines
660 B
Go
Raw Permalink Normal View History

2023-04-27 04:19:33 +00:00
package natsio
import (
"errors"
"time"
)
// Config ...
type Config struct {
// Connect url
URL string
// Auth user
User string
// Auth password
Password string
// TLS config
TLS *TLSConfig
// RequestTimeout
RequestTimeout time.Duration
// Stream name
StreamName string
// Debug
Debug bool
}
func (c Config) validate() error {
if c.URL == "" {
return errors.New("connect URL is required")
}
if c.StreamName == "" {
return errors.New("stream name is required")
}
return nil
}
// TLSConfig ...
type TLSConfig struct {
// Cert file
CertFilePath string
// Key file
KeyFilePath string
// Root CA
RootCAFilePath string
}