config

package
v0.0.0-...-bf444b6 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoConfig = errors.New("no config provided") // no configuration provided
)

Functions

This section is empty.

Types

type CORSConfig

type CORSConfig struct {
	Enabled          bool     `mapstructure:"enabled"`
	AllowedOrigins   []string `mapstructure:"allowed_origins"`
	AllowedMethods   []string `mapstructure:"allowed_methods"`
	AllowedHeaders   []string `mapstructure:"allowed_headers"`
	AllowCredentials bool     `mapstructure:"allow_credentials"`
	MaxAge           int      `mapstructure:"max_age"`
}

CORSConfig represents the CORS configuration.

type CacheDatabaseConfig

type CacheDatabaseConfig struct {
	RedisConfig           `mapstructure:",squash"`
	MaxIdleConnections    int           `mapstructure:"max_idle_connections"`
	MinIdleConnections    int           `mapstructure:"min_idle_connections"`
	ConnectionMaxIdleTime time.Duration `mapstructure:"connection_max_idle_time"`
	ConnectionMaxLifetime time.Duration `mapstructure:"connection_max_lifetime"`
}

CacheDatabaseConfig is the configuration for the cache database.

func (*CacheDatabaseConfig) ConnectionURL

func (c *CacheDatabaseConfig) ConnectionURL() string

ConnectionURL returns the connection URL for the cache database.

type Config

type Config struct {
	Log                 LogConfig                `mapstructure:"log"`
	License             LicenseConfig            `mapstructure:"license"`
	Server              ServerConfig             `mapstructure:"server"`
	MetricsServer       ServerConfig             `mapstructure:"metrics_server"`
	Worker              WorkerConfig             `mapstructure:"worker"`
	WorkerMetricsServer ServerConfig             `mapstructure:"worker_metrics_server"`
	GraphDatabase       GraphDatabaseConfig      `mapstructure:"graph_database"`
	RelationalDatabase  RelationalDatabaseConfig `mapstructure:"relational_database"`
	CacheDatabase       CacheDatabaseConfig      `mapstructure:"cache_database"`
	Tracing             TracingConfig            `mapstructure:"tracing"`
	SMTP                SMTPConfig               `mapstructure:"smtp"`
	Template            TemplateConfig           `mapstructure:"template"`
}

Config is the combined configuration for the service.

type GraphDatabaseConfig

type GraphDatabaseConfig struct {
	Host                         string        `mapstructure:"host"`
	Port                         int           `mapstructure:"port"`
	Username                     string        `mapstructure:"username"`
	Password                     string        `mapstructure:"password"`
	Database                     string        `mapstructure:"database"`
	IsSecure                     bool          `mapstructure:"is_secure"`
	MaxTransactionRetryTime      time.Duration `mapstructure:"max_transaction_retry_time"`
	MaxConnectionPoolSize        int           `mapstructure:"max_connection_pool_size"`
	MaxConnectionLifetime        time.Duration `mapstructure:"max_connection_lifetime"`
	ConnectionAcquisitionTimeout time.Duration `mapstructure:"connection_acquisition_timeout"`
	SocketConnectTimeout         time.Duration `mapstructure:"socket_connect_timeout"`
	SocketKeepalive              bool          `mapstructure:"socket_keepalive"`
	FetchSize                    int           `mapstructure:"fetch_size"`
}

GraphDatabaseConfig is the configuration for the graph database.

func (*GraphDatabaseConfig) ConnectionURL

func (c *GraphDatabaseConfig) ConnectionURL() string

ConnectionURL returns the connection URL for the graph database.

type LicenseConfig

type LicenseConfig struct {
	File string `mapstructure:"file"`
}

LicenseConfig is the configuration for the license.

type LogConfig

type LogConfig struct {
	Level string `mapstructure:"level"`
}

LogConfig is the configuration for the logger.

type RedisConfig

type RedisConfig struct {
	Host         string        `mapstructure:"host"`
	Port         int           `mapstructure:"port"`
	Username     string        `mapstructure:"username"`
	Password     string        `mapstructure:"password"`
	Database     int           `mapstructure:"database"`
	IsSecure     bool          `mapstructure:"is_secure"`
	DialTimeout  time.Duration `mapstructure:"dial_timeout"`
	ReadTimeout  time.Duration `mapstructure:"read_timeout"`
	WriteTimeout time.Duration `mapstructure:"write_timeout"`
	PoolSize     int           `mapstructure:"pool_size"`
}

RedisConfig is the configuration for the Redis database.

func (*RedisConfig) Address

func (c *RedisConfig) Address() string

Address returns the address for the Redis database.

type RelationalDatabaseConfig

type RelationalDatabaseConfig struct {
	Host                  string        `mapstructure:"host"`
	Port                  int           `mapstructure:"port"`
	Username              string        `mapstructure:"username"`
	Password              string        `mapstructure:"password"`
	Database              string        `mapstructure:"database"`
	IsSecure              bool          `mapstructure:"is_secure"`
	MaxConnections        int           `mapstructure:"max_connections"`
	MaxConnectionLifetime time.Duration `mapstructure:"max_connection_lifetime"`
	MaxConnectionIdleTime time.Duration `mapstructure:"max_connection_idle_time"`
	MinConnections        int           `mapstructure:"min_connections"`
}

RelationalDatabaseConfig is the configuration for the relational database.

func (*RelationalDatabaseConfig) ConnectionURL

func (c *RelationalDatabaseConfig) ConnectionURL() string

ConnectionURL returns the connection URL for the relational database.

type SMTPConfig

type SMTPConfig struct {
	Host              string        `mapstructure:"host"`
	Port              int           `mapstructure:"port"`
	Username          string        `mapstructure:"username"`
	Password          string        `mapstructure:"password"`
	Hostname          string        `mapstructure:"hostname"`
	ConnectionTimeout time.Duration `mapstructure:"connection_timeout"`
	EnableAuth        bool          `mapstructure:"enable_auth"`
	SkipTLSVerify     bool          `mapstructure:"skip_tls_verify"`
	SecurityProtocol  string        `mapstructure:"security_protocol"`
	FromAddress       string        `mapstructure:"from_address"`
	ReplyToAddress    string        `mapstructure:"reply_to_address"`
	SupportAddress    string        `mapstructure:"support_address"`
}

SMTPConfig is the configuration for the SMTP server used for sending notification emails.

type ServerConfig

type ServerConfig struct {
	Address                string        `mapstructure:"address"`
	ReadTimeout            time.Duration `mapstructure:"read_timeout"`
	WriteTimeout           time.Duration `mapstructure:"write_timeout"`
	RequestThrottleLimit   int           `mapstructure:"request_throttle_limit"`
	RequestThrottleBacklog int           `mapstructure:"request_throttle_backlog"`
	RequestThrottleTimeout time.Duration `mapstructure:"request_throttle_timeout"`
	CORS                   CORSConfig    `mapstructure:"cors"`
	Session                SessionConfig `mapstructure:"session"`
	TLS                    TLSConfig     `mapstructure:"tls"`
}

ServerConfig is the configuration for the HTTP server.

type SessionConfig

type SessionConfig struct {
	CookieName string `mapstructure:"cookie_name"`
	MaxAge     int    `mapstructure:"max_age"`
	Secure     bool   `mapstructure:"secure"`
}

SessionConfig is the configuration for the session.

type TLSConfig

type TLSConfig struct {
	CertFile string `mapstructure:"cert_file"`
	KeyFile  string `mapstructure:"key_file"`
}

TLSConfig is the configuration for TLS.

type TemplateConfig

type TemplateConfig struct {
	Directory string `mapstructure:"directory"`
}

TemplateConfig is the configuration for template files.

type TracingConfig

type TracingConfig struct {
	ServiceName       string  `mapstructure:"service_name"`
	CollectorEndpoint string  `mapstructure:"collector_endpoint"`
	TraceRatio        float64 `mapstructure:"trace_ratio"`
}

TracingConfig is the configuration for the tracing.

type WorkerConfig

type WorkerConfig struct {
	Concurrency              int           `mapstructure:"concurrency"`
	StrictPriority           bool          `mapstructure:"strict_priority"`
	ShutdownTimeout          time.Duration `mapstructure:"shutdown_timeout"`
	HealthCheckInterval      time.Duration `mapstructure:"health_check_interval"`
	DelayedTaskCheckInterval time.Duration `mapstructure:"delayed_task_check_interval"`
	GroupGracePeriod         time.Duration `mapstructure:"group_grace_period"`
	GroupMaxDelay            time.Duration `mapstructure:"group_max_delay"`
	GroupMaxSize             int           `mapstructure:"group_max_size"`
	LogLevel                 string        `mapstructure:"log_level"`
	RateLimit                float64       `mapstructure:"rate_limit"`
	RateLimitBurst           int           `mapstructure:"rate_limit_burst"`
	Broker                   RedisConfig   `mapstructure:"broker"`
}

WorkerConfig is the configuration for the async worker.

Jump to

Keyboard shortcuts

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