Documentation
¶
Index ¶
- Constants
- func Save(path string, config Config) error
- type Config
- func (c *Config) ApplyDefaults()
- func (c Config) ParseEngineThresholdBytes() (uint64, error)
- func (c Config) ParseEngineWindowBytes() (uint64, error)
- func (c Config) ParseLimitWindow() (time.Duration, error)
- func (c Config) ParseTokenTTL() (time.Duration, error)
- func (c Config) ParseWebSocketExecutionTimeout() (time.Duration, error)
- func (c Config) ParseWebSocketHeartbeat() (time.Duration, error)
- func (c Config) ParseWebSocketReadTimeout() (time.Duration, error)
- func (c Config) ParseWebSocketWriteTimeout() (time.Duration, error)
- func (c Config) Validate() error
- type DatabaseConfig
- type EngineConfig
- type EnginePersistenceConfig
- type EngineSecurityConfig
- type HTTPConfig
- type HTTPLimitConfig
- type HTTPRouteConfig
- type TransportConfig
- type WebSocketConfig
Constants ¶
View Source
const DefaultConfigPath = "simpleDB/config.yaml"
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Database DatabaseConfig `yaml:"database"`
Engine EngineConfig `yaml:"engine"`
Transport TransportConfig `yaml:"transport"`
}
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
func (Config) ParseEngineThresholdBytes ¶
func (Config) ParseEngineWindowBytes ¶
func (Config) ParseWebSocketExecutionTimeout ¶ added in v1.68.6
func (Config) ParseWebSocketHeartbeat ¶ added in v1.68.6
func (Config) ParseWebSocketReadTimeout ¶ added in v1.68.6
func (Config) ParseWebSocketWriteTimeout ¶ added in v1.68.6
type DatabaseConfig ¶
type DatabaseConfig struct {
Path string `yaml:"path"`
}
type EngineConfig ¶
type EngineConfig struct {
Persistence EnginePersistenceConfig `yaml:"persistence"`
Security EngineSecurityConfig `yaml:"security"`
}
type EnginePersistenceConfig ¶
type EngineSecurityConfig ¶
type HTTPConfig ¶
type HTTPConfig struct {
Enabled bool `yaml:"enabled"`
Address string `yaml:"address"`
GinMode string `yaml:"ginMode"`
Route HTTPRouteConfig `yaml:"route"`
Limit HTTPLimitConfig `yaml:"limit"`
InitPassword string `yaml:"initPassword"`
TokenTTL string `yaml:"tokenTTL"`
TokenSecret string `yaml:"tokenSecret"`
EnableAdmin bool `yaml:"enableAdminRoute"`
EnableReport bool `yaml:"enableReportRoute"`
// SQLAllowedOps 控制 /sql/execute 接口允许执行的语句类型。
// 可选值: select, insert, update, delete, create, drop, truncate, alter
// 留空表示不限制(默认开放全部,建议生产环境按需收紧)。
SQLAllowedOps []string `yaml:"sqlAllowedOps"`
}
type HTTPLimitConfig ¶
type HTTPRouteConfig ¶
type HTTPRouteConfig struct {
Health string `yaml:"health"`
Profile string `yaml:"profile"`
Login string `yaml:"login"`
Register string `yaml:"register"`
Refresh string `yaml:"refresh"`
Logout string `yaml:"logout"`
Activate string `yaml:"activate"`
Deactivate string `yaml:"deactivate"`
AssignRole string `yaml:"assignRole"`
AssignRolePermission string `yaml:"assignRolePermission"`
InitSDBPassword string `yaml:"initSDBPassword"`
SQLExecute string `yaml:"sql"`
SQLGrant string `yaml:"sqlGrant"`
SQLRevoke string `yaml:"sqlRevoke"`
Admin string `yaml:"admin"`
Report string `yaml:"report"`
}
type TransportConfig ¶
type TransportConfig struct {
HTTP HTTPConfig `yaml:"http"`
WebSocket WebSocketConfig `yaml:"websocket"`
}
type WebSocketConfig ¶ added in v1.68.6
Click to show internal directories.
Click to hide internal directories.