server

package
v1.34.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultSessionLifetime = 24 * time.Hour
	DefaultGitHubTimeout   = 10 * time.Second

	DefaultWebhookWorkers   = 10
	DefaultWebhookQueueSize = 100

	DefaultHTTPCacheSize     = 50 * datasize.MB
	DefaultPushedAtCacheSize = 100_000
)
View Source
const (
	DefaultEnvPrefix = "POLICYBOT_"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CachingConfig

type CachingConfig struct {
	// The maximum size of the the HTTP cache associated with each GitHub
	// client. The total amount of memory used for caching is approximately
	// this value multiplied by the total number of active GitHub clients.
	MaxSize datasize.ByteSize `yaml:"max_size"`

	// The size of the global cache for commit push times. Each entry uses
	// roughly 100 bytes of memory.
	PushedAtSize int `yaml:"pushed_at_size"`
}

type Config

type Config struct {
	Server     baseapp.HTTPConfig            `yaml:"server"`
	Logging    LoggingConfig                 `yaml:"logging"`
	Cache      CachingConfig                 `yaml:"cache"`
	Github     githubapp.Config              `yaml:"github"`
	Sessions   SessionsConfig                `yaml:"sessions"`
	Options    handler.PullEvaluationOptions `yaml:"options"`
	Files      handler.FilesConfig           `yaml:"files"`
	Datadog    datadog.Config                `yaml:"datadog"`
	Prometheus prometheus.Config             `yaml:"prometheus"`
	Workers    WorkerConfig                  `yaml:"workers"`
}

func ParseConfig

func ParseConfig(bytes []byte) (*Config, error)

type LoggingConfig

type LoggingConfig struct {
	Level string `yaml:"level" json:"level"`
	Text  bool   `yaml:"text" json:"text"`
}

func (*LoggingConfig) SetValuesFromEnv added in v1.27.4

func (c *LoggingConfig) SetValuesFromEnv(prefix string)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

func New(c *Config) (*Server, error)

New instantiates a new Server. Callers must then invoke Start to run the Server.

func (*Server) Start

func (s *Server) Start() error

Start is blocking and long-running

type SessionsConfig

type SessionsConfig struct {
	Key      string `yaml:"key"`
	Lifetime string `yaml:"lifetime"`
}

type WorkerConfig

type WorkerConfig struct {
	Workers       int           `yaml:"workers"`
	QueueSize     int           `yaml:"queue_size"`
	GithubTimeout time.Duration `yaml:"github_timeout"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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