config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiConfig

type ApiConfig struct {
	AuthHeaders map[string]string `yaml:"auth_headers"`
	Headers     map[string]string `yaml:"headers"`
	Enabled     bool              `yaml:"enabled"`
	CORS        CORSConfig
}

type AuthConfig

type AuthConfig struct {
	User     string `yaml:"user"`
	Password string `yaml:"password"`
}

type CORSConfig added in v0.2.0

type CORSConfig struct {
	Enabled             bool
	AllowedOrigins      []string          `yaml:"allowed_origins"`
	AllowedOriginsRegex OriginRegexConfig `yaml:"allowed_origins_regex"`
}

type CacheConfig

type CacheConfig struct {
	Redis    RedisConfig
	MongoDb  MongoDbConfig  `yaml:"mongodb"`
	DynamoDb DynamoDbConfig `yaml:"dynamodb"`
}

func (*CacheConfig) IsSet added in v0.5.0

func (c *CacheConfig) IsSet() bool

type CdnProxyConfig

type CdnProxyConfig struct {
	Headers map[string]string `yaml:"headers"`
	Enabled bool              `yaml:"enabled"`
	CORS    CORSConfig
}

type CertConfig

type CertConfig struct {
	Key  string `yaml:"key"`
	Cert string `yaml:"cert"`
}

type Config

type Config struct {
	Log                 LogConfig
	SDKs                map[string]*SDKConfig
	Grpc                GrpcConfig
	Tls                 TlsConfig
	Diag                DiagConfig
	Http                HttpConfig
	Cache               CacheConfig
	HttpProxy           HttpProxyConfig     `yaml:"http_proxy"`
	GlobalOfflineConfig GlobalOfflineConfig `yaml:"offline"`
	DefaultAttrs        model.UserAttrs     `yaml:"default_user_attributes"`
}

func LoadConfigFromFileAndEnvironment

func LoadConfigFromFileAndEnvironment(filePath string) (Config, error)

func (*Config) Validate

func (c *Config) Validate() error

type DiagConfig added in v0.4.0

type DiagConfig struct {
	Port    int           `yaml:"port"`
	Enabled bool          `yaml:"enabled"`
	Metrics MetricsConfig `yaml:"metrics"`
	Status  StatusConfig  `yaml:"status"`
}

type DynamoDbConfig added in v0.5.0

type DynamoDbConfig struct {
	Enabled bool   `yaml:"enabled"`
	Url     string `yaml:"url"`
	Table   string `yaml:"table"`
}

type GlobalOfflineConfig added in v0.1.5

type GlobalOfflineConfig struct {
	Enabled           bool `yaml:"enabled"`
	CachePollInterval int  `yaml:"cache_poll_interval"`
	Log               LogConfig
}

type GrpcConfig

type GrpcConfig struct {
	Enabled                 bool            `yaml:"enabled"`
	Port                    int             `yaml:"port"`
	ServerReflectionEnabled bool            `yaml:"server_reflection_enabled"`
	HealthCheckEnabled      bool            `yaml:"health_check_enabled"`
	KeepAlive               KeepAliveConfig `yaml:"keep_alive"`
	Log                     LogConfig
}

type HttpConfig

type HttpConfig struct {
	Enabled  bool
	Port     int            `yaml:"port"`
	CdnProxy CdnProxyConfig `yaml:"cdn_proxy"`
	Log      LogConfig
	Webhook  WebhookConfig
	Sse      SseConfig
	Api      ApiConfig
	Status   StatusConfig
}

type HttpProxyConfig

type HttpProxyConfig struct {
	Url string `yaml:"url"`
}

type KeepAliveConfig added in v0.4.2

type KeepAliveConfig struct {
	MaxConnectionIdle     int `yaml:"max_connection_idle"`
	MaxConnectionAge      int `yaml:"max_connection_age"`
	MaxConnectionAgeGrace int `yaml:"max_connection_age_grace"`
	Time                  int `yaml:"time"`
	Timeout               int `yaml:"timeout"`
}

func (*KeepAliveConfig) ToParams added in v0.4.2

type LocalConfig

type LocalConfig struct {
	FilePath     string `yaml:"file_path"`
	Polling      bool   `yaml:"polling"`
	PollInterval int    `yaml:"poll_interval"`
}

type LogConfig

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

func (*LogConfig) GetLevel

func (l *LogConfig) GetLevel() log.Level

type MetricsConfig

type MetricsConfig struct {
	Enabled bool `yaml:"enabled"`
}

type MongoDbConfig added in v0.5.0

type MongoDbConfig struct {
	Enabled    bool   `yaml:"enabled"`
	Url        string `yaml:"url"`
	Database   string `yaml:"database"`
	Collection string `yaml:"collection"`
	Tls        TlsConfig
}

type OfflineConfig

type OfflineConfig struct {
	Enabled           bool `yaml:"enabled"`
	UseCache          bool `yaml:"use_cache"`
	CachePollInterval int  `yaml:"cache_poll_interval"`
	Log               LogConfig
	Local             LocalConfig
}

type OriginRegexConfig added in v0.2.1

type OriginRegexConfig struct {
	IfNoMatch string `yaml:"if_no_match"`
	Patterns  []string

	Regexes []*regexp.Regexp `yaml:"-"`
}

type RedisConfig

type RedisConfig struct {
	Enabled   bool     `yaml:"enabled"`
	Addresses []string `yaml:"addresses"`
	DB        int      `yaml:"db"`
	User      string   `yaml:"user"`
	Password  string   `yaml:"password"`
	Tls       TlsConfig
}

type SDKConfig

type SDKConfig struct {
	Key                      string          `yaml:"key"`
	BaseUrl                  string          `yaml:"base_url"`
	PollInterval             int             `yaml:"poll_interval"`
	DataGovernance           string          `yaml:"data_governance"`
	WebhookSignatureValidFor int             `yaml:"webhook_signature_valid_for"`
	WebhookSigningKey        string          `yaml:"webhook_signing_key"`
	DefaultAttrs             model.UserAttrs `yaml:"default_user_attributes"`
	Offline                  OfflineConfig
	Log                      LogConfig
}

type SseConfig

type SseConfig struct {
	Enabled           bool              `yaml:"enabled"`
	Headers           map[string]string `yaml:"headers"`
	HeartBeatInterval int               `yaml:"heart_beat_interval"`
	Log               LogConfig
	CORS              CORSConfig
}

type StatusConfig added in v0.4.0

type StatusConfig struct {
	Enabled bool `yaml:"enabled"`
}

type TlsConfig

type TlsConfig struct {
	Enabled      bool    `yaml:"enabled"`
	MinVersion   float64 `yaml:"min_version"`
	ServerName   string  `yaml:"server_name"`
	Certificates []CertConfig
}

func (*TlsConfig) GetVersion

func (t *TlsConfig) GetVersion() uint16

func (*TlsConfig) LoadTlsOptions added in v0.5.0

func (t *TlsConfig) LoadTlsOptions() (*tls.Config, error)

type WebhookConfig

type WebhookConfig struct {
	AuthHeaders map[string]string `yaml:"auth_headers"`
	Enabled     bool              `yaml:"enabled"`
	Auth        AuthConfig
}

Jump to

Keyboard shortcuts

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