config

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig

type AppConfig struct {
	AdminUsername     string `koanf:"admin_username" validate:"required,min=1"`
	AdminPassword     string `koanf:"admin_password" validate:"required,min=8"`
	RootURL           string `koanf:"root_url" validate:"required,url"`
	Address           string `koanf:"address" validate:"required"`
	UseTLS            bool   `koanf:"use_tls"`
	HTTPTLSCert       string `koanf:"http_tls_cert" validate:"required_if=UseTLS true"`
	HTTPTLSKey        string `koanf:"http_tls_key" validate:"required_if=UseTLS true"`
	FlowsDirectory    string `koanf:"flows_directory" validate:"required"`
	MaxFileUploadSize int64  `koanf:"max_file_upload_size" validate:"required,min=1"`
	PluginDir         string `koanf:"plugin_dir"`
}

type Config

type Config struct {
	DB         DBConfig         `koanf:"db"`
	App        AppConfig        `koanf:"app"`
	Keystore   KeystoreConfig   `koanf:"keystore"`
	OIDC       []OIDCConfig     `koanf:"oidc" validate:"dive"`
	Scheduler  SchedulerConfig  `koanf:"scheduler"`
	Logger     Logger           `koanf:"logger"`
	Metrics    Metrics          `koanf:"metrics"`
	Messengers MessengersConfig `koanf:"messengers"`
}

func GetDefaultConfig

func GetDefaultConfig() Config

GetDefaultConfig returns the default configuration values

func Load

func Load(configPath string) (Config, error)

func (*Config) Validate added in v0.6.0

func (c *Config) Validate() error

type DBConfig

type DBConfig struct {
	DSN         string `koanf:"dsn"`
	DBName      string `koanf:"dbname" validate:"required_without=DSN"`
	User        string `koanf:"user" validate:"required_without=DSN"`
	Password    string `koanf:"password" validate:"required_without=DSN"`
	Host        string `koanf:"host" validate:"required_without=DSN"`
	Port        int    `koanf:"port" validate:"required_without=DSN,omitempty,min=1,max=65535"`
	SSLMode     string `koanf:"sslmode" validate:"omitempty,oneof=disable allow prefer require verify-ca verify-full"`
	SSLCert     string `koanf:"sslcert"`
	SSLKey      string `koanf:"sslkey"`
	SSLRootCert string `koanf:"sslrootcert"`
}

func (DBConfig) ConnectionString

func (db DBConfig) ConnectionString() string

ConnectionString returns the database connection string. If DSN is set, it returns the DSN directly else it builds a URL.

type KeystoreConfig

type KeystoreConfig struct {
	KeeperURL string `koanf:"keeper_url" validate:"required"`
}

type Logger

type Logger struct {
	Backend       string        `koanf:"backend"`
	Directory     string        `koanf:"log_directory" validate:"required"`
	MaxSizeBytes  int64         `koanf:"max_size_bytes" validate:"min=0"`
	RetentionTime time.Duration `koanf:"retention_time" validate:"min=0"`
	ScanInterval  time.Duration `koanf:"scan_interval" validate:"min=1s"`
}

type MessengersConfig added in v0.2.0

type MessengersConfig struct {
	Email   SMTPConfig    `koanf:"email"`
	Webhook WebhookConfig `koanf:"webhook"`
}

type Metrics

type Metrics struct {
	Enabled bool   `koanf:"enabled"`
	Path    string `koanf:"path"`
}

type OIDCAutoCreateConfig added in v0.9.0

type OIDCAutoCreateConfig struct {
	Enabled        bool     `koanf:"enabled"`
	Namespace      string   `koanf:"namespace"`
	Role           string   `koanf:"role"`
	Groups         []string `koanf:"groups"`
	AllowedDomains []string `koanf:"allowed_domains"`
}

type OIDCConfig

type OIDCConfig struct {
	Name            string               `koanf:"name" validate:"required,alpha"`
	Issuer          string               `koanf:"issuer" validate:"required,url"`
	AuthURL         string               `koanf:"auth_url" validate:"omitempty,url"`
	TokenURL        string               `koanf:"token_url" validate:"omitempty,url"`
	RedirectURL     string               `koanf:"redirect_url" validate:"omitempty,url"`
	ClientID        string               `koanf:"client_id" validate:"required"`
	ClientSecret    string               `koanf:"client_secret" validate:"required"`
	Label           string               `koanf:"label"`
	AutoCreateUsers OIDCAutoCreateConfig `koanf:"auto_create_users"`
}

type SMTPConfig added in v0.2.0

type SMTPConfig struct {
	Enabled     bool   `koanf:"enabled"`
	Host        string `koanf:"host" validate:"required_if=Enabled true"`
	Port        int    `koanf:"port" validate:"required_if=Enabled true,min=1,max=65535"`
	Username    string `koanf:"username"`
	Password    string `koanf:"password"`
	FromAddress string `koanf:"from_address" validate:"required_if=Enabled true,email"`
	FromName    string `koanf:"from_name"`
	MaxConns    int    `koanf:"max_conns" validate:"min=1"`
	SSL         string `koanf:"ssl" validate:"omitempty,oneof=none tls starttls"`
}

type SchedulerConfig

type SchedulerConfig struct {
	WorkerCount          int           `koanf:"workers" validate:"min=1"`
	Backend              string        `koanf:"backend"`
	CronSyncInterval     time.Duration `koanf:"cron_sync_interval" validate:"min=1s"`
	FlowExecutionTimeout time.Duration `koanf:"flow_execution_timeout" validate:"min=1s"`
}

type WebhookConfig added in v0.8.0

type WebhookConfig struct {
	Enabled    bool          `koanf:"enabled"`
	SigningKey string        `koanf:"signing_key" validate:"required_if=Enabled true"`
	Timeout    time.Duration `koanf:"timeout"`
}

Jump to

Keyboard shortcuts

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