Documentation
¶
Index ¶
- Variables
- func BindConfigToContext(ctx context.Context) context.Context
- func Reload() error
- func Watch(callback func(*Config))
- type Auth
- type Casbin
- type Config
- type Consul
- type DBNode
- type Data
- type Email
- type Extension
- type Frontend
- type GRPC
- type JWT
- type Logger
- type OAuth
- type Observes
- type Sentry
- type Storage
- type Tracer
Constants ¶
This section is empty.
Variables ¶
var ProviderSet = wire.NewSet( GetConfig, ProvideLoggerConfig, ProvideDataConfig, ProvideExtensionConfig, ProvideAuthConfig, ProvideStorageConfig, ProvideEmailConfig, ProvideOAuthConfig, )
ProviderSet is the wire provider set for the config package. It provides the main *Config and extracts sub-configurations for other modules to use.
Usage:
wire.Build(
config.ProviderSet,
// ... other providers
)
Available configurations:
- *Config: Main configuration
- *Logger: Logger configuration
- *Data: Data layer configuration
- *Extension: Extension system configuration
- *Auth: Authentication configuration
- *Storage: Storage configuration
- *Email: Email configuration
- *OAuth: OAuth configuration
Functions ¶
func BindConfigToContext ¶
BindConfigToContext binds the configuration to the context.
Types ¶
type Auth ¶
type Auth struct {
JWT *JWT `json:"jwt" yaml:"jwt"`
Casbin *Casbin `json:"casbin" yaml:"casbin"`
Whitelist []string `json:"whitelist" yaml:"whitelist"`
MaxSessions int `json:"max_sessions" yaml:"max_sessions"`
SessionCleanupInterval int `json:"session_cleanup_interval" yaml:"session_cleanup_interval"`
}
Auth auth config struct
func ProvideAuthConfig ¶ added in v0.2.0
ProvideAuthConfig provides the authentication configuration.
type Config ¶
type Config struct {
AppName string `yaml:"app_name" json:"app_name"`
Environment string `yaml:"environment" json:"environment"`
Protocol string `yaml:"protocol" json:"protocol"`
Domain string `yaml:"domain" json:"domain"`
Host string `yaml:"host" json:"host"`
Port int `yaml:"port" json:"port"`
GRPC *GRPC `yaml:"grpc" json:"grpc"`
Consul *Consul `yaml:"consul" json:"consul"`
Observes *Observes `yaml:"observes" json:"observes"`
Extension *Extension `yaml:"extension" json:"extension"`
Frontend *Frontend `yaml:"frontend" json:"frontend"`
Logger *Logger `yaml:"logger" json:"logger"`
Data *Data `yaml:"data" json:"data"`
Auth *Auth `yaml:"auth" json:"auth"`
Storage *Storage `yaml:"storage" json:"storage"`
OAuth *OAuth `yaml:"oauth" json:"oauth"`
Email *Email `yaml:"email" json:"email"`
Viper *viper.Viper `yaml:"-" json:"-"`
}
Config represents the configuration implementation.
func GetConfig ¶
GetConfig returns the configuration. It does not handle errors internally; instead, it returns the error for the caller to handle.
func LoadConfig ¶
LoadConfig loads the configuration from the file.
type Consul ¶
type Consul struct {
Address string `yaml:"address" json:"address"`
Scheme string `yaml:"scheme" json:"scheme"`
Discovery struct {
DefaultTags []string `yaml:"default_tags" json:"default_tags"`
DefaultMeta map[string]string `yaml:"default_meta" json:"default_meta"`
HealthCheck bool `yaml:"health_check" json:"health_check"`
CheckInterval string `yaml:"check_interval" json:"check_interval"`
Timeout string `yaml:"timeout" json:"timeout"`
} `yaml:"discovery" json:"discovery"`
}
Consul config struct
type Data ¶
Data represents the data configuration
func ProvideDataConfig ¶ added in v0.2.0
ProvideDataConfig provides the data layer configuration.
type Email ¶
Email represents the email configuration
func ProvideEmailConfig ¶ added in v0.2.0
ProvideEmailConfig provides the email configuration.
type Extension ¶
Extension represents the extension configuration
func ProvideExtensionConfig ¶ added in v0.2.0
ProvideExtensionConfig provides the extension system configuration.
type Frontend ¶
type Frontend struct {
SignInURL string `json:"sign_in_url" yaml:"sign_in_url"`
SignUpURL string `json:"sign_up_url" yaml:"sign_up_url"`
}
Frontend frontend config struct
type Logger ¶
Logger represents the logger configuration
func ProvideLoggerConfig ¶ added in v0.2.0
ProvideLoggerConfig provides the logger configuration.
type OAuth ¶
OAuth represents the OAuth configuration
func ProvideOAuthConfig ¶ added in v0.2.0
ProvideOAuthConfig provides the OAuth configuration.
type Sentry ¶
type Sentry struct {
Endpoint string `json:"endpoint" yaml:"endpoint"`
}
Sentry config struct
type Storage ¶
func ProvideStorageConfig ¶ added in v0.2.0
ProvideStorageConfig provides the storage configuration.