Documentation ¶
Index ¶
- Variables
- func StoreConfig[T any, C any](config C) (T, error)
- func StringToBoolHookFunc() mapstructure.DecodeHookFuncType
- func StringToIntHookFunc() mapstructure.DecodeHookFuncType
- type AsymmetricSignatureConfig
- type AuthMethodType
- type DGateAdminConfig
- type DGateBasicAuthConfig
- type DGateConfig
- type DGateDashboardConfig
- type DGateFileConfig
- type DGateHttpTransportConfig
- type DGateJWTAuthConfig
- type DGateKeyAuthConfig
- type DGateNativeModulesConfig
- type DGateProxyConfig
- type DGateReplicationConfig
- type DGateResources
- type DGateStorageConfig
- type DGateTLSConfig
- type DGateTestServerConfig
- type DGateUserCredentials
- type DomainSpec
- type ErrorFunc
- type FoundFunc
- type LoggingConfig
- type ModuleSpec
- type RaftConfig
- type StorageType
- type SymmetricSignatureConfig
Constants ¶
This section is empty.
Variables ¶
View Source
var ( EnvVarRegex = regexp.MustCompile(`\${(?P<var_name>[a-zA-Z0-9_]{1,})(:-(?P<default>.*?)?)?}`) CommandRegex = regexp.MustCompile(`\$\((?P<cmd>.*?)\)`) )
Functions ¶
func StoreConfig ¶
func StringToBoolHookFunc ¶
func StringToBoolHookFunc() mapstructure.DecodeHookFuncType
func StringToIntHookFunc ¶
func StringToIntHookFunc() mapstructure.DecodeHookFuncType
Types ¶
type AuthMethodType ¶
type AuthMethodType string
const ( AuthMethodNone AuthMethodType = "none" AuthMethodBasicAuth AuthMethodType = "basic" AuthMethodKeyAuth AuthMethodType = "key" AuthMethodJWTAuth AuthMethodType = "jwt" )
type DGateAdminConfig ¶
type DGateAdminConfig struct { Host string `koanf:"host"` Port int `koanf:"port"` AllowList []string `koanf:"allow_list"` XForwardedForDepth int `koanf:"x_forwarded_for_depth"` WatchOnly bool `koanf:"watch_only"` Replication *DGateReplicationConfig `koanf:"replication,omitempty"` TLS *DGateTLSConfig `koanf:"tls"` AuthMethod AuthMethodType `koanf:"auth_method"` BasicAuth *DGateBasicAuthConfig `koanf:"basic_auth"` KeyAuth *DGateKeyAuthConfig `koanf:"key_auth"` JWTAuth *DGateJWTAuthConfig `koanf:"jwt_auth"` }
type DGateBasicAuthConfig ¶
type DGateBasicAuthConfig struct {
Users []DGateUserCredentials `koanf:"users"`
}
type DGateConfig ¶
type DGateConfig struct { Version string `koanf:"version"` LogLevel string `koanf:"log_level,string"` LogJson bool `koanf:"log_json"` LogColor bool `koanf:"log_color"` NodeId string `koanf:"node_id"` Logging *LoggingConfig `koanf:"Logger"` Storage DGateStorageConfig `koanf:"storage"` ProxyConfig DGateProxyConfig `koanf:"proxy"` AdminConfig *DGateAdminConfig `koanf:"admin"` TestServerConfig *DGateTestServerConfig `koanf:"test_server"` DisableMetrics bool `koanf:"disable_metrics"` DisableDefaultNamespace bool `koanf:"disable_default_namespace"` Debug bool `koanf:"debug"` Tags []string `koanf:"tags"` }
func LoadConfig ¶
func LoadConfig(dgateConfigPath string) (*DGateConfig, error)
type DGateDashboardConfig ¶
type DGateDashboardConfig struct {
Enable bool `koanf:"enable"`
}
type DGateFileConfig ¶
type DGateFileConfig struct {
Dir string `koanf:"dir"`
}
type DGateHttpTransportConfig ¶
type DGateHttpTransportConfig struct { DNSServer string `koanf:"dns_server"` DNSTimeout time.Duration `koanf:"dns_timeout"` DNSPreferGo bool `koanf:"dns_prefer_go"` MaxIdleConns int `koanf:"max_idle_conns"` MaxIdleConnsPerHost int `koanf:"max_idle_conns_per_host"` MaxConnsPerHost int `koanf:"max_conns_per_host"` IdleConnTimeout time.Duration `koanf:"idle_conn_timeout"` ForceAttemptHttp2 bool `koanf:"force_attempt_http2"` DisableCompression bool `koanf:"disable_compression"` TLSHandshakeTimeout time.Duration `koanf:"tls_handshake_timeout"` ExpectContinueTimeout time.Duration `koanf:"expect_continue_timeout"` MaxResponseHeaderBytes int64 `koanf:"max_response_header_bytes"` WriteBufferSize int `koanf:"write_buffer_size"` ReadBufferSize int `koanf:"read_buffer_size"` MaxBodyBytes int `koanf:"max_body_bytes"` DisableKeepAlives bool `koanf:"disable_keep_alives"` KeepAlive time.Duration `koanf:"keep_alive"` ResponseHeaderTimeout time.Duration `koanf:"response_header_timeout"` DialTimeout time.Duration `koanf:"dial_timeout"` DisablePrivateIPs bool `koanf:"disable_private_ips"` }
type DGateJWTAuthConfig ¶
type DGateKeyAuthConfig ¶
type DGateProxyConfig ¶
type DGateProxyConfig struct { Host string `koanf:"host"` Port int `koanf:"port"` TLS *DGateTLSConfig `koanf:"tls"` EnableH2C bool `koanf:"enable_h2c"` EnableHTTP2 bool `koanf:"enable_http2"` ConsoleLogLevel string `koanf:"console_log_level"` RedirectHttpsDomains []string `koanf:"redirect_https"` AllowedDomains []string `koanf:"allowed_domains"` GlobalHeaders map[string]string `koanf:"global_headers"` Transport DGateHttpTransportConfig `koanf:"client_transport"` DisableXForwardedHeaders bool `koanf:"disable_x_forwarded_headers"` StrictMode bool `koanf:"strict_mode"` XForwardedForDepth int `koanf:"x_forwarded_for_depth"` // WARN: debug use only InitResources *DGateResources `koanf:"init_resources"` }
type DGateReplicationConfig ¶
type DGateReplicationConfig struct { RaftID string `koanf:"id"` BootstrapCluster bool `koanf:"bootstrap_cluster"` DiscoveryDomain string `koanf:"discovery_domain"` ClusterAddrs []string `koanf:"cluster_address"` AdvertAddr string `koanf:"advert_address"` AdvertScheme string `koanf:"advert_scheme"` RaftConfig *RaftConfig `koanf:"raft_config"` }
func (*DGateReplicationConfig) LoadRaftConfig ¶
func (config *DGateReplicationConfig) LoadRaftConfig(defaultConfig *raft.Config) *raft.Config
type DGateResources ¶
type DGateResources struct { SkipValidation bool `koanf:"skip_validation"` Namespaces []spec.Namespace `koanf:"namespaces"` Services []spec.Service `koanf:"services"` Routes []spec.Route `koanf:"routes"` Modules []ModuleSpec `koanf:"modules"` Domains []DomainSpec `koanf:"domains"` Collections []spec.Collection `koanf:"collections"` Documents []spec.Document `koanf:"documents"` Secrets []spec.Secret `koanf:"secrets"` }
func (*DGateResources) Validate ¶
func (resources *DGateResources) Validate() (int, error)
type DGateStorageConfig ¶
type DGateStorageConfig struct { StorageType StorageType `koanf:"type"` Config map[string]any `koanf:",remain"` }
type DGateTLSConfig ¶
type DGateTestServerConfig ¶
type DGateUserCredentials ¶
type DomainSpec ¶
type LoggingConfig ¶ added in v0.8.0
type ModuleSpec ¶
type RaftConfig ¶
type RaftConfig struct { HeartbeatTimeout time.Duration `koanf:"heartbeat_timeout"` ElectionTimeout time.Duration `koanf:"election_timeout"` CommitTimeout time.Duration `koanf:"commit_timeout"` SnapshotInterval time.Duration `koanf:"snapshot_interval"` SnapshotThreshold int `koanf:"snapshot_threshold"` MaxAppendEntries int `koanf:"max_append_entries"` TrailingLogs int `koanf:"trailing_logs"` LeaderLeaseTimeout time.Duration `koanf:"leader_lease_timeout"` }
type StorageType ¶
type StorageType string
const ( StorageTypeMemory StorageType = "memory" StorageTypeFile StorageType = "file" )
func (StorageType) String ¶ added in v0.11.0
func (st StorageType) String() string
Click to show internal directories.
Click to hide internal directories.