Documentation
¶
Index ¶
- func Connect(cfg Config) (*gorm.DB, error)
- func NewDatabaseConnection(cfg Config) *gorm.DB
- type AdminConfig
- type AuthConfig
- type Config
- func (c Config) AdminAddress() string
- func (c Config) AdminEnabled() bool
- func (c Config) AuthBaseURL() string
- func (c Config) AuthEnabled() bool
- func (c Config) AuthProvider() string
- func (c Config) AutoMigrateEnabled() bool
- func (c Config) Decode(target any) error
- func (c Config) PluginConfig(name string) json.RawMessage
- func (c Config) PublicAddress() string
- func (c Config) RBACEnabled() bool
- func (c Config) SourcePath() string
- func (c Config) UploadAddress() string
- func (c Config) Validate() error
- type DatabaseConfig
- type LoggingConfig
- type ObservabilityConfig
- type RBACConfig
- type ServerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDatabaseConnection ¶
NewDatabaseConnection is kept for source compatibility. New applications should use Connect so startup errors can be returned to the caller.
Types ¶
type AdminConfig ¶
type AuthConfig ¶
type Config ¶
type Config struct {
Prod bool `json:"prod"`
AppName string `json:"app_name"`
AuthDomain string `json:"auth_domain"`
Languages []string `json:"languages"`
Domains []string `json:"domains"`
Auth AuthConfig `json:"auth"`
RBAC RBACConfig `json:"rbac"`
Admin AdminConfig `json:"admin"`
Servers []ServerConfig `json:"servers"`
Database DatabaseConfig `json:"database"`
Observability ObservabilityConfig `json:"observability"`
Logging LoggingConfig `json:"logging"`
Plugins map[string]json.RawMessage `json:"plugins,omitempty"`
// contains filtered or unexported fields
}
func LoadConfiguration ¶
func (Config) AdminAddress ¶
func (Config) AdminEnabled ¶
func (Config) AuthBaseURL ¶
func (Config) AuthEnabled ¶
func (Config) AuthProvider ¶
func (Config) AutoMigrateEnabled ¶
func (Config) Decode ¶ added in v0.7.1
Decode unmarshals the already loaded and environment-expanded source config into an application-owned structure. It does not read the file again.
func (Config) PluginConfig ¶ added in v0.2.0
func (c Config) PluginConfig(name string) json.RawMessage
func (Config) PublicAddress ¶
func (Config) RBACEnabled ¶
func (Config) SourcePath ¶ added in v0.7.1
SourcePath returns the path used to load this runtime configuration.
func (Config) UploadAddress ¶
type DatabaseConfig ¶
type DatabaseConfig struct {
Driver string `json:"driver"`
Host string `json:"host"`
User string `json:"user"`
Password string `json:"password"`
DbName string `json:"dbname"`
Port int `json:"port"`
Charset string `json:"charset"`
SSLMode string `json:"sslmode"`
TimeZone string `json:"timezone"`
MaxOpenConns int `json:"max_open_conns"`
MaxIdleConns int `json:"max_idle_conns"`
ConnMaxLifetimeSeconds int `json:"conn_max_lifetime_seconds"`
ConnMaxIdleTimeSeconds int `json:"conn_max_idle_time_seconds"`
AutoMigrate *bool `json:"auto_migrate"`
MigrationsDir string `json:"migrations_dir"`
MigrationsTable string `json:"migrations_table"`
}
type LoggingConfig ¶
type LoggingConfig struct {
Level string `json:"level"`
FileEnabled bool `json:"file_enabled"`
FileDir string `json:"file_dir"`
}
func (LoggingConfig) WithDefaults ¶
func (cfg LoggingConfig) WithDefaults() LoggingConfig
type ObservabilityConfig ¶
type ObservabilityConfig struct {
Namespace string `json:"namespace"`
TraceExporter string `json:"trace_exporter"`
MetricsExporter string `json:"metrics_exporter"`
TraceOTLPEndpoint string `json:"trace_otlp_endpoint"`
TraceSampleRatio float64 `json:"trace_sample_ratio"`
// derived by WithDefaults — not in JSON
ServiceName string `json:"service_name"`
ServiceVersion string `json:"service_version"`
Environment string `json:"environment"`
TraceOTLPInsecure bool
}
func (ObservabilityConfig) WithDefaults ¶
func (cfg ObservabilityConfig) WithDefaults(appVersion, appName string, prod bool) ObservabilityConfig
type RBACConfig ¶
type ServerConfig ¶
Click to show internal directories.
Click to hide internal directories.