Documentation
¶
Index ¶
- func ApplyDefaults(cfg *Config)
- type AccessControlConfig
- type CORSConfig
- type CacheConfig
- type CaptchaConfig
- type Config
- type CookieConfig
- type DatabaseConfig
- type DomainConfig
- type FeatureToggle
- type FrontendConfig
- type InitConfig
- type LogConfig
- type MathConfig
- type MetricsConfig
- type MultiTenancyConfigdeprecated
- type PluginsConfig
- type ProjectConfigdeprecated
- type SecurityConfig
- type ServerConfig
- type TracingConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyDefaults ¶
func ApplyDefaults(cfg *Config)
ApplyDefaults fills in runtime defaults for optional settings.
Types ¶
type AccessControlConfig ¶
type AccessControlConfig struct {
MultiTenancy MultiTenancyConfig `mapstructure:"multi_tenancy"` // Deprecated: use Domain config
Project ProjectConfig `mapstructure:"project"` // Deprecated: managed by tenant plugin
Domain DomainConfig `mapstructure:"domain"`
ABAC FeatureToggle `mapstructure:"abac"`
Quota FeatureToggle `mapstructure:"quota"`
Audit FeatureToggle `mapstructure:"audit"`
}
type CORSConfig ¶
type CORSConfig struct {
Enabled bool `mapstructure:"enabled"`
AllowedOrigins []string `mapstructure:"allowed_origins"`
AllowedMethods []string `mapstructure:"allowed_methods"`
AllowedHeaders []string `mapstructure:"allowed_headers"`
ExposedHeaders []string `mapstructure:"exposed_headers"`
AllowCredentials bool `mapstructure:"allow_credentials"`
MaxAge int `mapstructure:"max_age"`
}
type CacheConfig ¶
type CacheConfig struct {
Host string `mapstructure:"host"`
Port string `mapstructure:"port"`
Password string `mapstructure:"password"`
DB int `mapstructure:"db"`
}
func (*CacheConfig) Addr ¶
func (c *CacheConfig) Addr() string
type CaptchaConfig ¶
type CaptchaConfig struct {
Enabled bool `mapstructure:"enabled"`
TTL string `mapstructure:"ttl"`
GenerateLimit int `mapstructure:"generate_limit"`
GenerateWindow string `mapstructure:"generate_window"`
MaxAttempts int `mapstructure:"max_attempts"`
AttemptWindow string `mapstructure:"attempt_window"`
Math MathConfig `mapstructure:"math"`
}
type Config ¶
type Config struct {
Server ServerConfig `mapstructure:"server"`
Database DatabaseConfig `mapstructure:"database"`
Cache CacheConfig `mapstructure:"cache"`
Log LogConfig `mapstructure:"log"`
Tracing TracingConfig `mapstructure:"tracing"`
Metrics MetricsConfig `mapstructure:"metrics"`
Security SecurityConfig `mapstructure:"security"`
AccessControl AccessControlConfig `mapstructure:"access_control"`
Plugins PluginsConfig `mapstructure:"plugins"`
Init InitConfig `mapstructure:"init"`
Frontend FrontendConfig `mapstructure:"frontend"`
Captcha CaptchaConfig `mapstructure:"captcha"`
}
func LoadConfig ¶
func LoadConfig() *Config
type CookieConfig ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
// URL is kept for backward compatibility; if set, it takes precedence over the fields below.
URL string `mapstructure:"url"`
Host string `mapstructure:"host"`
Port string `mapstructure:"port"`
Username string `mapstructure:"username"`
Password string `mapstructure:"password"`
Name string `mapstructure:"name"`
SSLMode string `mapstructure:"sslmode"`
Params string `mapstructure:"params"`
AutoMigrate bool `mapstructure:"auto_migrate"`
MaxOpenConns int `mapstructure:"max_open_conns"`
MaxIdleConns int `mapstructure:"max_idle_conns"`
}
func (DatabaseConfig) DSN ¶
func (c DatabaseConfig) DSN() string
func (DatabaseConfig) Validate ¶
func (c DatabaseConfig) Validate() error
type DomainConfig ¶
type DomainConfig struct {
// Mode controls domain resolution: "domain" (new) or "tenant" (legacy compat).
Mode string `mapstructure:"mode"`
// DefaultDomainID is the fallback domain ID when none is resolved.
DefaultDomainID string `mapstructure:"default_domain_id"`
}
DomainConfig configures the domain kernel behavior.
type FeatureToggle ¶
type FeatureToggle struct {
Enabled bool `mapstructure:"enabled"`
}
type FrontendConfig ¶
type FrontendConfig struct {
URL string `mapstructure:"url"`
}
type InitConfig ¶
type InitConfig struct {
SecretKey string `mapstructure:"secret_key"`
}
type LogConfig ¶
type LogConfig struct {
Director string `mapstructure:"director" json:"director" yaml:"director" toml:"director"`
MessageKey string `mapstructure:"message-key" json:"messageKey" yaml:"message-key" toml:"message-key"`
LevelKey string `mapstructure:"level-key" json:"levelKey" yaml:"level-key" toml:"level-key"`
TimeKey string `mapstructure:"time-key" json:"timeKey" yaml:"time-key" toml:"time-key"`
NameKey string `mapstructure:"name-key" json:"nameKey" yaml:"name-key" toml:"name-key"`
CallerKey string `mapstructure:"caller-key" json:"callerKey" yaml:"caller-key" toml:"caller-key"`
LineEnding string `mapstructure:"line-ending" json:"lineEnding" yaml:"line-ending" toml:"line-ending"`
StacktraceKey string `mapstructure:"stacktrace-key" json:"stacktraceKey" yaml:"stacktrace-key" toml:"stacktrace-key"`
Level string `mapstructure:"level" json:"level" yaml:"level" toml:"level"`
EncodeLevel string `mapstructure:"encode-level" json:"encodeLevel" yaml:"encode-level" toml:"encode-level"`
Prefix string `mapstructure:"prefix" json:"prefix" yaml:"prefix" toml:"prefix"`
TimeFormat string `mapstructure:"time-format" json:"timeFormat" yaml:"time-format" toml:"time-format"`
Format string `mapstructure:"format" json:"format" yaml:"format" toml:"format"`
LogInTerminal bool `mapstructure:"log-in-terminal" json:"logInTerminal" yaml:"log-in-terminal" toml:"log-in-terminal"`
MaxAge int `mapstructure:"max-age" json:"maxAge" yaml:"max-age" toml:"max-age"`
MaxSize int `mapstructure:"max-size" json:"maxSize" yaml:"max-size" toml:"max-size"`
MaxBackups int `mapstructure:"max-backups" json:"maxBackups" yaml:"max-backups" toml:"max-backups"`
Compress bool `mapstructure:"compress" json:"compress" yaml:"compress" toml:"compress"`
ShowLineNumber bool `mapstructure:"show-line-number" json:"showLineNumber" yaml:"show-line-number" toml:"show-line-number"`
}
func (LogConfig) ToLoggingConfig ¶
ToLoggingConfig converts LogConfig to framework/logging.Config.
type MathConfig ¶
type MetricsConfig ¶
type MetricsConfig struct {
Port string `mapstructure:"port"`
}
type MultiTenancyConfig
deprecated
type PluginsConfig ¶
type PluginsConfig struct {
OU FeatureToggle `mapstructure:"ou"`
}
type ProjectConfig
deprecated
type SecurityConfig ¶
type SecurityConfig struct {
JWTSecret string `mapstructure:"jwt_secret"`
TokenExpiry int `mapstructure:"token_expiry"`
RefreshExpiry int `mapstructure:"refresh_expiry"`
PasswordCost int `mapstructure:"password_cost"`
EnableRateLimit bool `mapstructure:"enable_rate_limit"`
RateLimit int `mapstructure:"rate_limit"`
Cookie CookieConfig `mapstructure:"cookie"`
}
type ServerConfig ¶
type ServerConfig struct {
Port int `mapstructure:"port"`
Mode string `mapstructure:"mode"`
CORS CORSConfig `mapstructure:"cors"`
}
type TracingConfig ¶
Click to show internal directories.
Click to hide internal directories.