Documentation
¶
Overview ¶
Package config provides configuration structures for the Flight SQL server.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthConfig ¶
type AuthConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Type string `yaml:"type" json:"type"` // basic, bearer, mtls, oauth2
// Basic auth
BasicAuth BasicAuthConfig `yaml:"basic_auth" json:"basic_auth"`
// Bearer token auth
BearerAuth BearerAuthConfig `yaml:"bearer_auth" json:"bearer_auth"`
// JWT auth
JWTAuth JWTAuthConfig `yaml:"jwt_auth" json:"jwt_auth"`
// OAuth2 auth
OAuth2Auth OAuth2Config `yaml:"oauth2_auth" json:"oauth2_auth"`
}
AuthConfig represents authentication configuration.
type BasicAuthConfig ¶
type BasicAuthConfig struct {
UsersFile string `yaml:"users_file" json:"users_file"`
Users map[string]UserInfo `yaml:"users" json:"users"`
}
BasicAuthConfig represents basic authentication configuration.
type BearerAuthConfig ¶
type BearerAuthConfig struct {
TokensFile string `yaml:"tokens_file" json:"tokens_file"`
Tokens map[string]string `yaml:"tokens" json:"tokens"` // token -> username
}
BearerAuthConfig represents bearer token authentication configuration.
type CacheConfig ¶
type CacheConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
MaxSize int64 `yaml:"max_size" json:"max_size"`
TTL time.Duration `yaml:"ttl" json:"ttl"`
CleanupInterval time.Duration `yaml:"cleanup_interval" json:"cleanup_interval"`
EnableStats bool `yaml:"enable_stats" json:"enable_stats"`
PreparedStatements CacheItemConfig `yaml:"prepared_statements" json:"prepared_statements"`
QueryResults CacheItemConfig `yaml:"query_results" json:"query_results"`
}
CacheConfig represents cache configuration.
type CacheItemConfig ¶
type CacheItemConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
MaxSize int64 `yaml:"max_size" json:"max_size"`
TTL time.Duration `yaml:"ttl" json:"ttl"`
}
CacheItemConfig represents cache item configuration.
type Config ¶
type Config struct {
// Server settings
Address string `yaml:"address" json:"address"`
Database string `yaml:"database" json:"database"`
LogLevel string `yaml:"log_level" json:"log_level"`
MaxConnections int `yaml:"max_connections" json:"max_connections"`
ConnectionTimeout time.Duration `yaml:"connection_timeout" json:"connection_timeout"`
QueryTimeout time.Duration `yaml:"query_timeout" json:"query_timeout"`
MaxMessageSize int64 `yaml:"max_message_size" json:"max_message_size"`
ShutdownTimeout time.Duration `yaml:"shutdown_timeout" json:"shutdown_timeout"`
// TLS configuration
TLS TLSConfig `yaml:"tls" json:"tls"`
// Authentication configuration
Auth AuthConfig `yaml:"auth" json:"auth"`
// Metrics configuration
Metrics MetricsConfig `yaml:"metrics" json:"metrics"`
// Health check configuration
Health HealthConfig `yaml:"health" json:"health"`
// gRPC reflection
Reflection bool `yaml:"reflection" json:"reflection"`
// Connection pool configuration
ConnectionPool ConnectionPoolConfig `yaml:"connection_pool" json:"connection_pool"`
// Transaction configuration
Transaction TransactionConfig `yaml:"transaction" json:"transaction"`
// Cache configuration
Cache CacheConfig `yaml:"cache" json:"cache"`
// Performance options
SafeCopy bool `yaml:"safe_copy" json:"safe_copy"`
}
Config represents the server configuration.
func LoadFromFile ¶
LoadFromFile loads configuration from a YAML or JSON file.
type ConnectionPoolConfig ¶
type ConnectionPoolConfig struct {
MaxOpenConnections int `yaml:"max_open_connections" json:"max_open_connections"`
MaxIdleConnections int `yaml:"max_idle_connections" json:"max_idle_connections"`
ConnMaxLifetime time.Duration `yaml:"conn_max_lifetime" json:"conn_max_lifetime"`
ConnMaxIdleTime time.Duration `yaml:"conn_max_idle_time" json:"conn_max_idle_time"`
HealthCheckPeriod time.Duration `yaml:"health_check_period" json:"health_check_period"`
}
ConnectionPoolConfig represents connection pool configuration.
type HealthConfig ¶
type HealthConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Interval time.Duration `yaml:"interval" json:"interval"`
}
HealthConfig represents health check configuration.
type JWTAuthConfig ¶
type JWTAuthConfig struct {
Secret string `yaml:"secret" json:"secret"`
Issuer string `yaml:"issuer" json:"issuer"`
Audience string `yaml:"audience" json:"audience"`
}
JWTAuthConfig represents JWT authentication configuration.
type MetricsConfig ¶
type MetricsConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
Address string `yaml:"address" json:"address"`
Path string `yaml:"path" json:"path"`
}
MetricsConfig represents metrics configuration.
type OAuth2Config ¶
type OAuth2Config struct {
ClientID string `yaml:"client_id" json:"client_id"`
ClientSecret string `yaml:"client_secret" json:"client_secret"`
AuthorizeEndpoint string `yaml:"authorize_endpoint" json:"authorize_endpoint"`
TokenEndpoint string `yaml:"token_endpoint" json:"token_endpoint"`
RedirectURL string `yaml:"redirect_url" json:"redirect_url"`
Scopes []string `yaml:"scopes" json:"scopes"`
AccessTokenTTL time.Duration `yaml:"access_token_ttl" json:"access_token_ttl"`
RefreshTokenTTL time.Duration `yaml:"refresh_token_ttl" json:"refresh_token_ttl"`
AllowedGrantTypes []string `yaml:"allowed_grant_types" json:"allowed_grant_types"`
}
OAuth2Config represents OAuth2 authentication configuration.
type TLSConfig ¶
type TLSConfig struct {
Enabled bool `yaml:"enabled" json:"enabled"`
CertFile string `yaml:"cert_file" json:"cert_file"`
KeyFile string `yaml:"key_file" json:"key_file"`
CAFile string `yaml:"ca_file" json:"ca_file"`
// Mutual TLS
ClientAuth bool `yaml:"client_auth" json:"client_auth"`
ClientCACertFile string `yaml:"client_ca_cert_file" json:"client_ca_cert_file"`
InsecureSkipVerify bool `yaml:"insecure_skip_verify" json:"insecure_skip_verify"`
}
TLSConfig represents TLS configuration.
type TransactionConfig ¶
type TransactionConfig struct {
DefaultIsolationLevel string `yaml:"default_isolation_level" json:"default_isolation_level"`
MaxTransactionAge time.Duration `yaml:"max_transaction_age" json:"max_transaction_age"`
CleanupInterval time.Duration `yaml:"cleanup_interval" json:"cleanup_interval"`
}
TransactionConfig represents transaction configuration.