config

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRequestTimeout = 2 * time.Second

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentConfig

type AgentConfig struct {
	OfflineThreshold time.Duration `mapstructure:"offline_threshold" validate:"required,min=1s"`
}

type AuthConfig

type AuthConfig struct {
	JWT    JWTConfig    `mapstructure:"jwt" validate:"required"`
	OpenID OpenIDConfig `mapstructure:"openid"`
}

type Config

type Config struct {
	HTTP    HTTPConfig    `mapstructure:"http" validate:"required"`
	DB      DbConfig      `mapstructure:"db" validate:"required"`
	Auth    AuthConfig    `mapstructure:"auth" validate:"required"`
	Page    PageConfig    `mapstructure:"page" validate:"required"`
	Agent   AgentConfig   `mapstructure:"agent" validate:"required"`
	Metrics MetricsConfig `mapstructure:"metrics"`
}

func DefaultConfig

func DefaultConfig() *Config

type DbConfig

type DbConfig struct {
	Type     string                 `mapstructure:"type" validate:"required,excludesall=!@#$ "`
	LogLevel DbLogLevel             `mapstructure:"log_level"`
	Config   map[string]interface{} `mapstructure:"config"`
}

type DbLogLevel added in v0.0.2

type DbLogLevel string

DbLogLevel represents the database logging level

const (
	DbLogLevelSilent DbLogLevel = "silent"
	DbLogLevelError  DbLogLevel = "error"
	DbLogLevelWarn   DbLogLevel = "warn"
	DbLogLevelInfo   DbLogLevel = "info"
)

type HTTPConfig

type HTTPConfig struct {
	Listen string `mapstructure:"listen" validate:"required"`
}

type JWTConfig

type JWTConfig struct {
	Secret          string        `mapstructure:"secret" validate:"required,min=32"`
	AccessTokenTTL  time.Duration `mapstructure:"access_token_ttl" validate:"required,min=1m"`
	RefreshTokenTTL time.Duration `mapstructure:"refresh_token_ttl" validate:"required,min=1h"`
	Issuer          string        `mapstructure:"issuer" validate:"required"`
	HeaderName      string        `mapstructure:"header_name"`
}

type MetricsConfig added in v0.0.2

type MetricsConfig struct {
	Enabled bool   `mapstructure:"enabled"`
	Listen  string `mapstructure:"listen"`
}

type OpenIDConfig

type OpenIDConfig struct {
	Enabled      bool     `mapstructure:"enabled"`
	Name         string   `mapstructure:"name"`
	Icon         string   `mapstructure:"icon"`
	ProviderURL  string   `mapstructure:"provider_url" validate:"required_if=Enabled true,omitempty,url"`
	ClientID     string   `mapstructure:"client_id" validate:"required_if=Enabled true"`
	ClientSecret string   `mapstructure:"client_secret" validate:"required_if=Enabled true"`
	RedirectURL  string   `mapstructure:"redirect_url" validate:"required_if=Enabled true,omitempty,url"`
	Scopes       []string `mapstructure:"scopes"`
	RolesClaim   string   `mapstructure:"roles_claim"`
}

type PageConfig

type PageConfig struct {
	SizeLimit      int `mapstructure:"size_limit" validate:"required,min=1"`
	TotalSizeLimit int `mapstructure:"total_size_limit" validate:"required,min=2,gtfield=SizeLimit"`
}

Jump to

Keyboard shortcuts

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