config

package
v0.0.0-...-de41a1e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Which ip to bind to
	BindIp string `json:"bind_ip"`
	// Which port to bind to
	BindPort int `json:"bind_port" required:"true"`
	// Certificate file in order to enable TLS
	Certificate string `json:"certificate" required:"true"`
	// Certificate's private key
	CertificateKey string `json:"certificate_key" required:"true"`
	// Directory containing all the appropriate files to load the CA
	CertificateAuthoritiesDir string `json:"certificate_authorities_dir" required:"true"`
	// token for ams interaction
	AmsToken string `json:"ams_token" required:"true"`
	// Ams endpoint
	AmsHost string `json:"ams_host" required:"true"`
	// Ams port
	AmsPort int `json:"ams_port" required:"true"`
	// Whether any http client spawn inside  the service should accept to talk to non https connections
	VerifySSL bool `json:"verify_ssl"`
	// whether the service will start with tls enabled
	TLSEnabled bool `json:"tls_enabled"`
	// Trust incoming certificates signed from unknown CAs
	TrustUnknownCAs bool `json:"trust_unknown_cas"`
	// log level(DEBUG,INFO,WARNING,ERROR)
	LogLevel string `json:"log_level" required:"true"`
	// whether or not it should try to load any push enabled subscriptions, upon starting up
	SkipSubsLoad bool `json:"skip_subs_load"`

	// list of certificate DNs that should be allowed to access the service
	ACL []string `json:"acl"`
	// Enable direct logging of the service to the syslog facility
	SyslogEnabled bool `json:"syslog_enabled"`
	// contains filtered or unexported fields
}

Config contains all the needed information for the server to function properly

func NewMockConfig

func NewMockConfig() *Config

NewMockConfig returns a config to be used in tests

func (*Config) GetClientAuthType

func (cfg *Config) GetClientAuthType() tls.ClientAuthType

GetClientAuthType returns which client auth strategy should the server follow when validating a certificate

func (*Config) GetLogLevel

func (cfg *Config) GetLogLevel() log.Level

GetLogLevel maps the provided string log level inside the config to a log.Level if it can't map it, it will return log.LevelInfo

func (*Config) GetTLSConfig

func (cfg *Config) GetTLSConfig() *tls.Config

GetTLSConfig returns the tls configuration needed for the grpc server

func (*Config) LoadFromJson

func (cfg *Config) LoadFromJson(from io.Reader) error

LoadFromJson fills the config struct with the contents of the reader

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL