config

package
v0.0.0-...-0db91f5 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const DBTypeRedis string = "redis"
View Source
const DBTypeRedisMock string = "redis-mock"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthorizationVerifier

type AuthorizationVerifier struct {
	Issuer          string
	Audience        string
	AuthorizedParty string
}

type Config

type Config struct {
	RunningEnvironment
	DebugMode  bool
	Server     ServerConfig
	Sessions   SessionConfig
	Revproxy   RevproxyConfig
	Login      LoginConfig
	Redis      RedisConfig
	Monitoring MonitoringConfig
}

func (Config) Validate

func (c Config) Validate() error

type ConfigHandler

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

func NewConfigHandler

func NewConfigHandler() *ConfigHandler

Creates a configuration handler that reads the configuration files, merges them and can watch them for changes. Please note that the merges replace whole arrays - they do not merge arrays. The secret file will always overwrite anything in the non-secret / regular file. And any environment variables will always rewrite stuff in the secret config, so the order of preference from most preferred to least is environment variables, secret config, non-secret config.

func (*ConfigHandler) Config

func (c *ConfigHandler) Config() (Config, error)

func (*ConfigHandler) HandleChanges

func (c *ConfigHandler) HandleChanges(callback func(Config, error))

func (*ConfigHandler) Watch

func (c *ConfigHandler) Watch()

type CoreSvcConfig

type CoreSvcConfig struct {
	ServiceNames []string
	ServicePaths []string
	Sticky       bool
}

type LoginConfig

type LoginConfig struct {
	RenkuBaseURL                *url.URL
	LoginRoutesBasePath         string
	TokenEncryption             TokenEncryptionConfig
	Providers                   map[string]OIDCClient
	OldGitLabLogout             bool
	LogoutGitLabUponRenkuLogout bool
}

func (LoginConfig) Validate

func (c LoginConfig) Validate(e RunningEnvironment) error

type MonitoringConfig

type MonitoringConfig struct {
	Sentry     SentryConfig
	Prometheus PrometheusConfig
}

type OIDCClient

type OIDCClient struct {
	Issuer            string
	ClientID          string
	ClientSecret      RedactedString
	Scopes            []string
	CallbackURI       string
	UsePKCE           bool
	CookieEncodingKey RedactedString
	CookieHashKey     RedactedString
	// NOTE: UnsafeNoCookieHandler should only be used for testing, in production this has to be false/unset
	// without this there is no CSRF protection on the oauth callback endpoint
	UnsafeNoCookieHandler bool
}

type PrometheusConfig

type PrometheusConfig struct {
	Enabled bool
	Port    int
}

type RateLimits

type RateLimits struct {
	Enabled bool
	Rate    float64
	Burst   int
}

type RedactedString

type RedactedString string

func (RedactedString) MarshalBinary

func (r RedactedString) MarshalBinary() ([]byte, error)

func (RedactedString) MarshalJSON

func (r RedactedString) MarshalJSON() ([]byte, error)

func (RedactedString) MarshalText

func (r RedactedString) MarshalText() ([]byte, error)

func (RedactedString) String

func (r RedactedString) String() string

type RedisConfig

type RedisConfig struct {
	Type       string
	Addresses  []string
	IsSentinel bool
	Password   RedactedString
	MasterName string
	DBIndex    int
}

func (RedisConfig) Validate

func (c RedisConfig) Validate(e RunningEnvironment) error

type RenkuServicesConfig

type RenkuServicesConfig struct {
	KG          *url.URL
	Webhook     *url.URL
	Core        CoreSvcConfig
	DataService *url.URL
	Keycloak    *url.URL
	UIServer    *url.URL
	Search      *url.URL
}

type RevproxyConfig

type RevproxyConfig struct {
	RenkuBaseURL      *url.URL
	ExternalGitlabURL *url.URL
	K8sNamespace      string
	RenkuServices     RenkuServicesConfig
}

func (*RevproxyConfig) Validate

func (r *RevproxyConfig) Validate() error

type RunningEnvironment

type RunningEnvironment string
const Development RunningEnvironment = "development"
const Production RunningEnvironment = "production"

type SentryConfig

type SentryConfig struct {
	Enabled     bool
	Dsn         RedactedString
	Environment string
	SampleRate  float64
}

type ServerConfig

type ServerConfig struct {
	Host        string
	Port        int
	RateLimits  RateLimits
	AllowOrigin []string
}

type SessionConfig

type SessionConfig struct {
	IdleSessionTTLSeconds  int
	MaxSessionTTLSeconds   int
	AuthorizationVerifiers []AuthorizationVerifier
	CookieEncodingKey      RedactedString
	CookieHashKey          RedactedString
	// NOTE: UnsafeNoCookieHandler should only be used for testing, in production this has to be false/unset
	// without this there is no CSRF protection on the oauth callback endpoint
	UnsafeNoCookieHandler bool
}

func (*SessionConfig) Validate

func (c *SessionConfig) Validate(e RunningEnvironment) error

type TokenEncryptionConfig

type TokenEncryptionConfig struct {
	Enabled   bool
	SecretKey RedactedString
}

Jump to

Keyboard shortcuts

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