config

package
v0.0.0-...-7febb3a Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2023 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LogLevelTypeTrace = "trace"
	LogLevelTypeDebug = "debug"
	LogLevelTypeInfo  = "info"
	LogLevelTypeWarn  = "warn"
	LogLevelTypeError = "error"
	LogLevelTypeFatal = "fatal"
)

Variables

View Source
var Version string

Functions

func BrokerName

func BrokerName() string

func GetHostname

func GetHostname() string

func Host

func Host() string

func NewConfigurationError

func NewConfigurationError(errStr string) error

func NewConfigurationErrorf

func NewConfigurationErrorf(format string, args ...interface{}) error

func ToSnakeCase

func ToSnakeCase(str string) string

Types

type ApiConfig

type ApiConfig struct {
	Port int `json:"port"`
}

func (*ApiConfig) Validate

func (a *ApiConfig) Validate() error

type AuthenticationConfig

type AuthenticationConfig struct {
	Enable    bool                     `json:"enable"`
	JwtConfig *JWTAuthenticationConfig `json:"jwtConfig"`
	Type      string                   `json:"type"`
	Config    string                   `json:"config"`
}

func (*AuthenticationConfig) Validate

func (c *AuthenticationConfig) Validate() error

type AuthorizationConfig

type AuthorizationConfig struct {
	Enable     bool   `json:"enable"`
	PolicyData string `json:"policyData"`
	FilePath   string `json:"filePath"`
	Url        string `json:"url"`
	AutoReload int    `json:"autoReload"`
}

func (*AuthorizationConfig) Validate

func (a *AuthorizationConfig) Validate() error

type BrokerConfig

type BrokerConfig struct {
	Port               int        `json:"-"`
	MaxPayload         int        `json:"maxPayload"`
	WriteDeadline      int        `json:"writeDeadline"`
	MaxConn            int        `json:"maxConn"`
	MonitoringPort     int        `json:"-"`
	MemoryPipe         *pipe.Pipe `json:"-"`
	WriteBufferSize    int        `json:"writeBufferSize"`
	ReadBufferSize     int        `json:"readBufferSize"`
	DiskSyncSeconds    int        `json:"diskSyncSeconds"`
	SliceMaxMessages   int        `json:"sliceMaxMessages"`
	SliceMaxBytes      int64      `json:"sliceMaxBytes"`
	SliceMaxAgeSeconds int        `json:"sliceMaxAgeSeconds"`
	ParallelRecovery   int        `json:"parallelRecovery"`
}

func (*BrokerConfig) Validate

func (b *BrokerConfig) Validate() error

type ClientConfig

type ClientConfig struct {
	GrpcHost   string `json:"grpcHost"`
	GrpcPort   int    `json:"grpcPort"`
	ApiAddress string `json:"apiAddress"`
	AuthToken  string `json:"authToken"`
	ClientID   string `json:"clientId"`
}

func (*ClientConfig) Validate

func (c *ClientConfig) Validate() error

type Config

type Config struct {
	Host           string                `json:"-"`
	Client         *ClientConfig         `json:"client"`
	Api            *ApiConfig            `json:"api"`
	Log            *LogConfig            `json:"log"`
	Broker         *BrokerConfig         `json:"broker"`
	Store          *StoreConfig          `json:"store"`
	Queue          *QueueConfig          `json:"queue"`
	Grpc           *GrpcConfig           `json:"grpc"`
	Rest           *RestConfig           `json:"rest"`
	Authorization  *AuthorizationConfig  `json:"authorization"`
	Authentication *AuthenticationConfig `json:"authentication"`
	Security       *SecurityConfig       `json:"security"`
	Routing        *RoutingConfig        `json:"routing"`
	// contains filtered or unexported fields
}

func GetAppConfig

func GetAppConfig(paths ...string) *Config

func GetConfig

func GetConfig() *Config

func GetCopyAppConfig

func GetCopyAppConfig(paths ...string) *Config

func GetDefaultConfig

func GetDefaultConfig() *Config

func (*Config) GetVersion

func (c *Config) GetVersion() string

func (*Config) SetVersion

func (c *Config) SetVersion(value string) *Config

func (*Config) Validate

func (c *Config) Validate() error

type GrpcConfig

type GrpcConfig struct {
	Port        int `json:"port"`
	SubBuffSize int `json:"subBuffSize"`
	BodyLimit   int `json:"bodyLimit"`
}

func (*GrpcConfig) Validate

func (g *GrpcConfig) Validate() error

type JWTAuthenticationConfig

type JWTAuthenticationConfig struct {
	Key           string `json:"key"`
	FilePath      string `json:"filePath"`
	SignatureType string `json:"signatureType"`
}

func (*JWTAuthenticationConfig) Validate

func (jc *JWTAuthenticationConfig) Validate() error

type LogConfig

type LogConfig struct {
	Level LogLevelType `json:"level"`
}

func (*LogConfig) Validate

func (l *LogConfig) Validate() error

type LogLevelType

type LogLevelType string

type QueueConfig

type QueueConfig struct {
	MaxNumberOfMessages       int32 `json:"maxNumberOfMessages"`
	MaxWaitTimeoutSeconds     int32 `json:"maxWaitTimeoutSeconds"`
	MaxExpirationSeconds      int32 `json:"maxExpirationSeconds"`
	MaxDelaySeconds           int32 `json:"maxDelaySeconds"`
	MaxReceiveCount           int32 `json:"maxReceiveCount"`
	MaxVisibilitySeconds      int32 `json:"maxVisibilitySeconds"`
	DefaultVisibilitySeconds  int32 `json:"defaultVisibilitySeconds"`
	DefaultWaitTimeoutSeconds int32 `json:"defaultWaitTimeoutSeconds"`
	MaxInflight               int32 `json:"maxInflight"`
	PubAckWaitSeconds         int32 `json:"pubAckWaitSeconds"`
}

func (*QueueConfig) Validate

func (q *QueueConfig) Validate() error

type ResourceConfig

type ResourceConfig struct {
	Filename string `json:"filename"`
	Data     string `json:"data"`
}

func (*ResourceConfig) Empty

func (r *ResourceConfig) Empty() bool

func (*ResourceConfig) Get

func (r *ResourceConfig) Get() ([]byte, error)

func (*ResourceConfig) GetWithoutWithSpace

func (r *ResourceConfig) GetWithoutWithSpace() ([]byte, error)

type RestConfig

type RestConfig struct {
	Port         int             `json:"port"`
	ReadTimeout  int             `json:"readTimeout"`
	WriteTimeout int             `json:"writeTimeout"`
	SubBuffSize  int             `json:"subBuffSize"`
	BodyLimit    string          `json:"bodyLimit"`
	Cors         *RestCorsConfig `json:"cors"`
}

func (*RestConfig) Validate

func (r *RestConfig) Validate() error

type RestCorsConfig

type RestCorsConfig struct {
	AllowOrigins     []string `json:"allowOrigins"`
	AllowMethods     []string `json:"allowMethods"`
	AllowHeaders     []string `json:"allowHeaders"`
	AllowCredentials bool     `json:"allowCredentials"`
	ExposeHeaders    []string `json:"exposeHeaders"`
	MaxAge           int      `json:"maxAge"`
}

func (*RestCorsConfig) Validate

func (rc *RestCorsConfig) Validate() error

type RoutingConfig

type RoutingConfig struct {
	Enable     bool   `json:"enable"`
	Data       string `json:"data"`
	FilePath   string `json:"filePath"`
	Url        string `json:"url"`
	AutoReload int    `json:"autoReload"`
}

func (*RoutingConfig) Validate

func (a *RoutingConfig) Validate() error

type SecurityConfig

type SecurityConfig struct {
	Cert *ResourceConfig `json:"cert"`
	Key  *ResourceConfig `json:"key"`
	Ca   *ResourceConfig `json:"ca"`
}

func (*SecurityConfig) Mode

func (s *SecurityConfig) Mode() SecurityModeType

func (*SecurityConfig) Validate

func (s *SecurityConfig) Validate() error

type SecurityModeType

type SecurityModeType int
const (
	SecurityModeNone SecurityModeType = iota
	SecurityModeTLS
	SecurityModeMTLS
)

type ServerState

type ServerState struct {
	Host                string `json:"host"`
	Version             string `json:"version"`
	ServerStartTime     int64  `json:"server_start_time"`
	ServerUpTimeSeconds int64  `json:"server_up_time_seconds"`
}

func GetServerState

func GetServerState() *ServerState

type StoreConfig

type StoreConfig struct {
	CleanStore       bool   `json:"cleanStore"`
	StorePath        string `json:"storePath"`
	MaxQueues        int    `json:"maxQueues"`
	MaxSubscribers   int    `json:"maxSubscribers"`
	MaxMessages      int    `json:"maxMessages"`
	MaxQueueSize     int64  `json:"maxQueueSize"`
	MaxRetention     int    `json:"maxRetention"`
	MaxPurgeInactive int    `json:"maxPurgeInactive"`
}

func (*StoreConfig) Validate

func (s *StoreConfig) Validate() error

Jump to

Keyboard shortcuts

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