config

package
v1.0.0-alpha.23 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvDevelopment = "dev"
	EnvProduction  = "prod"
	EnvSandbox     = "sbx"
	EnvTest        = "test"
	EnvLocal       = "local"
)

Variables

View Source
var DefaultConfig = Config{
	Log: log.LogConfig{
		Level:      "info",
		SampleRate: 0.01,
	},
	Server: ServerConfig{
		Host: "0.0.0.0",
		Port: 8081,
	},
	Auth: AuthConfig{
		IssuerURL:                "https://tigrisdata-dev.us.auth0.com/",
		Audience:                 "https://tigris-db-dev-preview-test",
		JWKSCacheTimeout:         5 * time.Minute,
		LogOnly:                  true,
		EnableNamespaceIsolation: false,
	},
	Cdc: CdcConfig{
		Enabled:        true,
		StreamInterval: 500 * time.Millisecond,
		StreamBatch:    100,
		StreamBuffer:   200,
	},
	Search: SearchConfig{
		Host:         "localhost",
		Port:         8108,
		ReadEnabled:  true,
		WriteEnabled: true,
	},
	Tracing: TracingConfig{
		Enabled:             false,
		SampleRate:          0.01,
		CodeHotspotsEnabled: true,
		EndpointsEnabled:    true,
	},
	Profiling: ProfilingConfig{
		Enabled:    false,
		EnableCPU:  true,
		EnableHeap: true,
	},
	Metrics: MetricsConfig{
		Enabled: true,
		Grpc: GrpcMetricsConfig{
			Enabled:      true,
			Counters:     true,
			ResponseTime: true,
		},
		Fdb: FdbMetricsConfig{
			Enabled:      true,
			Counters:     true,
			ResponseTime: true,
		},
	},
}

Functions

func GetEnvironment

func GetEnvironment() string

func LoadConfig

func LoadConfig(config interface{})

func LoadEnvironment

func LoadEnvironment()

Types

type AuthConfig

type AuthConfig struct {
	IssuerURL                string
	Audience                 string
	JWKSCacheTimeout         time.Duration
	LogOnly                  bool
	EnableNamespaceIsolation bool
}

type CdcConfig

type CdcConfig struct {
	Enabled        bool
	StreamInterval time.Duration
	StreamBatch    int
	StreamBuffer   int
}

type Config

type Config struct {
	Log          log.LogConfig
	Server       ServerConfig    `yaml:"server" json:"server"`
	Auth         AuthConfig      `yaml:"auth" json:"auth"`
	Cdc          CdcConfig       `yaml:"cdc" json:"cdc"`
	Search       SearchConfig    `yaml:"search" json:"search"`
	Tracing      TracingConfig   `yaml:"tracing" json:"tracing"`
	Profiling    ProfilingConfig `yaml:"profiling" json:"profiling"`
	Metrics      MetricsConfig
	FoundationDB FoundationDBConfig
}

type FdbMetricsConfig

type FdbMetricsConfig struct {
	Enabled      bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"`
	Counters     bool `mapstructure:"counters" yaml:"counters" json:"counters"`
	ResponseTime bool `mapstructure:"response_time" yaml:"response_time" json:"response_time"`
}

type FoundationDBConfig

type FoundationDBConfig struct {
	ClusterFile string `mapstructure:"cluster_file" json:"cluster_file" yaml:"cluster_file"`
}

FoundationDBConfig keeps FoundationDB configuration parameters

func GetTestFDBConfig

func GetTestFDBConfig(path string) (*FoundationDBConfig, error)

type GrpcMetricsConfig

type GrpcMetricsConfig struct {
	Enabled      bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"`
	Counters     bool `mapstructure:"counters" yaml:"counters" json:"counters"`
	ResponseTime bool `mapstructure:"response_time" yaml:"response_time" json:"response_time"`
}

type MetricsConfig

type MetricsConfig struct {
	// Global switch
	Enabled bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"`
	// Individual metric group configs
	Grpc GrpcMetricsConfig
	Fdb  FdbMetricsConfig
}

type ProfilingConfig

type ProfilingConfig struct {
	Enabled         bool `mapstructure:"enabled" yaml:"enabled" json:"enabled"`
	EnableCPU       bool `mapstructure:"enable_cpu" yaml:"enable_cpu" json:"enable_cpu"`
	EnableHeap      bool `mapstructure:"enable_heap" yaml:"enable_heap" json:"enable_heap"`
	EnableBlock     bool `mapstructure:"enable_block" yaml:"enable_block" json:"enable_block"`
	EnableMutex     bool `mapstructure:"enable_mutex" yaml:"enable_mutex" json:"enable_mutex"`
	EnableGoroutine bool `mapstructure:"enable_goroutine" yaml:"enable_goroutine" json:"enable_goroutine"`
}

type SearchConfig

type SearchConfig struct {
	Host         string
	Port         int16
	AuthKey      string `mapstructure:"auth_key" json:"auth_key" yaml:"auth_key"`
	ReadEnabled  bool
	WriteEnabled bool
}

type ServerConfig

type ServerConfig struct {
	Host string
	Port int16
}

type TracingConfig

type TracingConfig struct {
	Enabled             bool    `mapstructure:"enabled" yaml:"enabled" json:"enabled"`
	SampleRate          float64 `mapstructure:"sample_rate" yaml:"sample_rate" json:"sample_rate"`
	CodeHotspotsEnabled bool    `mapstructure:"codehotspots_enabled" yaml:"codehotspots_enabled" json:"codehotspots_enabled"`
	EndpointsEnabled    bool    `mapstructure:"endpoints_enabled" yaml:"endpoints_enabled" json:"endpoints_enabled"`
	WithUDS             string  `mapstructure:"agent_socket" yaml:"agent_socket" json:"agent_socket"`
	WithAgentAddr       string  `mapstructure:"agent_addr" yaml:"agent_addr" json:"agent_addr"`
	WithDogStatsdAddr   string  `mapstructure:"dogstatsd_addr" yaml:"dogstatsd_addr" json:"dogstatsd_addr"`
}

Jump to

Keyboard shortcuts

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