config

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP

type HTTP struct {
	// The address to listen on.
	Host string `yaml:"host,omitempty" json:"host,omitempty"`
	// The port to listen on.
	Port int `yaml:"port,omitempty" json:"port,omitempty"`
	// Rate limiter configuration.
	Rate RateLimiter `yaml:"rate,omitempty" json:"rate,omitempty"`
}

HTTP contains HTTP server configuration properties.

func NewHTTPDefault

func NewHTTPDefault() *HTTP

NewHTTPDefault returns a new HTTP config with default values.

type Logger

type Logger struct {
	// Level is the log level (DEBUG, INFO, WARN, WARNING, ERROR).
	Level string `yaml:"level,omitempty" json:"level,omitempty"`
	// Format is the log format (PLAIN, JSON).
	Format string `yaml:"format,omitempty" json:"format,omitempty"`
}

Logger contains the service logger configuration properties.

func NewLoggerDefault

func NewLoggerDefault() *Logger

NewLoggerDefault returns a new Logger with default values.

func (*Logger) SlogHandler

func (l *Logger) SlogHandler() (slog.Handler, error)

type RateLimiter

type RateLimiter struct {
	// Rate limiter tokens per second threshold.
	Tps int `yaml:"tps,omitempty" json:"tps,omitempty"`
	// Rate limiter token bucket size (bursts threshold).
	Size int `yaml:"size,omitempty" json:"size,omitempty"`
	// A list of IP addresses to exclude from rate limiting.
	WhiteList []string `yaml:"white-list,omitempty" json:"white-list,omitempty"`
}

RateLimiter contains rate limiter configuration properties.

type Secret

type Secret struct {
	// Private denotes the path to the private key.
	Private string `yaml:"private-path,omitempty" json:"private-path,omitempty"`
	// Public denotes the path to the public key.
	Public string `yaml:"public-path,omitempty" json:"public-path,omitempty"`
}

Secret holds the configuration for secret keys.

func NewSecretDefault

func NewSecretDefault() *Secret

NewSecretDefault returns a new Secret with default values.

type Service

type Service struct {
	SigningMethod      string  `yaml:"signing-method,omitempty" json:"signing-method,omitempty"`
	ProxyProvider      string  `yaml:"proxy,omitempty" json:"proxy,omitempty"`
	RepositoryProvider string  `yaml:"repository,omitempty" json:"repository,omitempty"`
	HTTP               *HTTP   `yaml:"http,omitempty" json:"http,omitempty"`
	Secret             *Secret `yaml:"secret,omitempty" json:"secret,omitempty"`
	Logger             *Logger `yaml:"logger,omitempty" json:"logger,omitempty"`
}

Service contains the entire service configuration.

func NewServiceDefault

func NewServiceDefault() *Service

NewServiceDefault returns a new Service config with default values.

func (*Service) Repository

func (c *Service) Repository() (repository.Repository, error)

func (*Service) RequestParser

func (c *Service) RequestParser() (proxy.RequestParser, error)

func (*Service) SigningMethodRSA

func (c *Service) SigningMethodRSA() (*jwt.SigningMethodRSA, error)

func (*Service) String

func (c *Service) String() string

String returns a string representation of the service configuration in JSON format.

func (*Service) StringYaml

func (c *Service) StringYaml() string

StringYaml returns a string representation of the service configuration in YAML format.

func (*Service) Validate

func (c *Service) Validate() error

Validate validates the service configuration.

Jump to

Keyboard shortcuts

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