config

package
v2.3.201 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: MIT Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	DefaultAccessTokenTTL  = 15           // Значение по умолчанию для TTL Access Token в минутах
	DefaultRefreshTokenTTL = 24 * 60 * 30 // Значение по умолчанию для TTL Refresh Token в минутах (30 дней)
	DefaultTimeout         = 10
)
View Source
const (
	DefaultTTL         = 15
	DefaultMaxAttempts = 3
)

Variables

This section is empty.

Functions

func Migrate

func Migrate(fs embed.FS, migrationsDir, migratePath string) error

Migrate выполняет миграции на основе предоставленных файлов миграций и пути к миграции. fs - файловая система, содержащая миграции. migrationsDir - директория в файловой системе, где хранятся миграции. migratePath - путь к файлу миграции.

func NewConfig

func NewConfig[T any](configPath string) (*T, error)

NewConfig создает и возвращает конфигурацию типа T, считывая данные из файла YAML. configPath - путь к файлу конфигурации YAML.

Types

type AUTH

type AUTH struct {
	Key             string  `yaml:"key"`                         // Ключ для аутентификации
	AccessTokenTTL  float64 `yaml:"access_token_ttl,omitempty"`  // TTL Access Token в минутах (опционально)
	RefreshTokenTTL float64 `yaml:"refresh_token_ttl,omitempty"` // TTL Refresh Token в минутах (опционально)
	LDAP            LDAP    `yaml:"ldap"`
	SSO             SSO     `yaml:"sso"`
}

type DB added in v2.2.15

type DB struct {
	DSN         string `yaml:"dsn,omitempty"`
	MaxIdleConn int    `yaml:"max_idle_conn,omitempty"`
	MaxOpenConn int    `yaml:"max_open_conn,omitempty"`
}

type HTTP

type HTTP struct {
	Host string `yaml:"host,omitempty"` // Порт может быть пустым и будет опущен из сериализованного YAML, если он не установлен
	Port string `yaml:"port"`           // Порт сервера (например, "8080")
}

type LDAP added in v2.3.149

type LDAP struct {
	Enabled    bool   `yaml:"enabled"`
	Addr       string `yaml:"addr"`
	BaseDN     string `yaml:"base_dn"`
	BaseFilter string `yaml:"base_filter"`
	LoginAttr  string `yaml:"login_attr"`
	Domain     string `yaml:"domain"`
}

type LOG added in v2.3.0

type LOG struct {
	Debug      string `yaml:"debug,omitempty"`
	Directory  string `yaml:"directory"`
	MaxSize    int    `yaml:"max_size"`
	MaxBackups int    `yaml:"max_backups"`
	MaxAge     int    `yaml:"max_age"`
	Compress   bool   `yaml:"compress"`
}

type Limiter added in v2.3.24

type Limiter struct {
	MaxAttempts int `yaml:"max_attempts,omitempty"`
	TTL         int `yaml:"ttl,omitempty"`
}

type OIDC added in v2.3.149

type OIDC struct {
	Enabled           bool     `yaml:"enabled"`
	ConfigURL         string   `yaml:"config_url"`
	ClientID          string   `yaml:"client_id"`
	ClientSecret      string   `yaml:"client_secret"`
	RootURL           string   `yaml:"root_url"`
	LoginAttr         string   `yaml:"login_attr"`
	ValidRedirectURLs []string `yaml:"valid_redirect_urls"`
}

type Redis

type Redis struct {
	Address     []string `yaml:"address"`      // Список адресов Redis серверов
	Username    string   `yaml:"username"`     // Имя пользователя для аутентификации Redis
	Password    string   `yaml:"password"`     // Пароль для аутентификации Redis
	ClusterMode bool     `yaml:"cluster_mode"` // Режим кластера Redis (true/false)
	DB          int      `yaml:"db"`           // Номер базы данных Redis (0 по умолчанию)
	MaxRetry    int      `yaml:"max_retry"`    // Максимальное количество попыток повторного подключения
}

type SAML added in v2.3.151

type SAML struct {
	Enabled           bool     `yaml:"enabled"`
	MetaDataURL       string   `yaml:"meta_data_url"`
	MetaDataPath      string   `yaml:"meta_data_path"`
	CertFile          string   `yaml:"cert_file"`
	KeyFile           string   `yaml:"key_file"`
	RootURL           string   `yaml:"root_url"`
	LoginAttr         string   `yaml:"login_attr"`
	ValidRedirectURLs []string `yaml:"valid_redirect_urls"`
}

type SSO added in v2.3.149

type SSO struct {
	OIDC OIDC `yaml:"oidc"`
	SAML SAML `yaml:"saml"`
}

Jump to

Keyboard shortcuts

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