Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // Log Log LogConfig `yaml:"log"` // Server Server ServerConfig `yaml:"server"` // Jwt Jwt JwtConfig `yaml:"jwt"` // Database Database DatabaseConfig `yaml:"database"` // Oauth2Plugins Oauth2Plugins Oauth2Plugins `yaml:"oauth2_plugins"` // RateLimit RateLimit RateLimitConfig `yaml:"rate_limit"` // Vendor Vendor VendorConfig `yaml:"vendor"` }
var (
Conf *Config
)
func DefaultConfig ¶
func DefaultConfig() *Config
type DatabaseConfig ¶ added in v0.3.0
type DatabaseConfig struct { Type DatabaseType `yaml:"type" lc:"default: sqlite3" hc:"support sqlite3, mysql, postgres" env:"DATABASE_TYPE"` Host string `yaml:"host" hc:"when type is not sqlite3, and port is 0, it will use unix socket file" env:"DATABASE_HOST"` Port uint16 `yaml:"port" env:"DATABASE_PORT"` User string `yaml:"user" env:"DATABASE_USER"` Password string `yaml:"password" env:"DATABASE_PASSWORD"` DBName string `yaml:"db_name" lc:"default: synctv" hc:"when type is sqlite3, it will use sqlite db file or memory" env:"DATABASE_DB_NAME"` SslMode string `` /* 146-byte string literal not displayed */ CustomDSN string `yaml:"custom_dsn" hc:"when not empty, it will ignore other config" env:"DATABASE_CUSTOM_DSN"` MaxIdleConns int `yaml:"max_idle_conns" hc:"sqlite3 does not support setting connection parameters" env:"DATABASE_MAX_IDLE_CONNS"` MaxOpenConns int `yaml:"max_open_conns" env:"DATABASE_MAX_OPEN_CONNS"` ConnMaxLifetime string `yaml:"conn_max_lifetime" env:"DATABASE_CONN_MAX_LIFETIME"` ConnMaxIdleTime string `yaml:"conn_max_idle_time" env:"DATABASE_CONN_MAX_IDLE_TIME"` }
func DefaultDatabaseConfig ¶ added in v0.3.0
func DefaultDatabaseConfig() DatabaseConfig
type DatabaseType ¶ added in v0.3.0
type DatabaseType string
const ( DatabaseTypeSqlite3 DatabaseType = "sqlite3" DatabaseTypeMysql DatabaseType = "mysql" DatabaseTypePostgres DatabaseType = "postgres" )
type HttpServerConfig ¶ added in v0.3.0
type HttpServerConfig struct { Listen string `yaml:"listen" env:"SERVER_LISTEN"` Port uint16 `yaml:"port" env:"SERVER_PORT"` Quic bool `yaml:"quic" hc:"enable http3/quic need set cert and key file" env:"SERVER_QUIC"` CertPath string `yaml:"cert_path" env:"SERVER_CERT_PATH"` KeyPath string `yaml:"key_path" env:"SERVER_KEY_PATH"` }
type JwtConfig ¶
type JwtConfig struct { Secret string `yaml:"secret" env:"JWT_SECRET"` Expire string `yaml:"expire" env:"JWT_EXPIRE"` }
func DefaultJwtConfig ¶
func DefaultJwtConfig() JwtConfig
type LogConfig ¶
type LogConfig struct { Enable bool `yaml:"enable" env:"LOG_ENABLE"` LogFormat string `yaml:"log_format" hc:"can be set: text | json" env:"LOG_FORMAT"` FilePath string `yaml:"file_path" hc:"if it is a relative path, the data-dir directory will be used." env:"LOG_FILE_PATH"` MaxSize int `yaml:"max_size" cm:"mb" hc:"max size per log file" env:"LOG_MAX_SIZE"` MaxBackups int `yaml:"max_backups" env:"LOG_MAX_BACKUPS"` MaxAge int `yaml:"max_age" env:"LOG_MAX_AGE"` Compress bool `yaml:"compress" env:"LOG_COMPRESS"` }
func DefaultLogConfig ¶
func DefaultLogConfig() LogConfig
type Oauth2Plugins ¶ added in v0.3.0
func DefaultOauth2Plugins ¶ added in v0.3.0
func DefaultOauth2Plugins() Oauth2Plugins
type RateLimitConfig ¶ added in v0.3.0
type RateLimitConfig struct { Enable bool `yaml:"enable" lc:"default: false" env:"SERVER_RATE_LIMIT_ENABLE"` Period string `yaml:"period" env:"SERVER_RATE_LIMIT_PERIOD"` Limit int64 `yaml:"limit" env:"SERVER_RATE_LIMIT_LIMIT"` TrustForwardHeader bool `` /* 325-byte string literal not displayed */ TrustedClientIPHeader string `` /* 307-byte string literal not displayed */ }
func DefaultRateLimitConfig ¶ added in v0.3.0
func DefaultRateLimitConfig() RateLimitConfig
type RtmpServerConfig ¶ added in v0.3.0
type ServerConfig ¶
type ServerConfig struct { Http HttpServerConfig `yaml:"http"` Rtmp RtmpServerConfig `yaml:"rtmp"` }
func DefaultServerConfig ¶
func DefaultServerConfig() ServerConfig
type VendorBilibili ¶ added in v0.3.0
type VendorBilibili struct { ServerName string `yaml:"server_name" hc:"if use tls and grpc, servername must set the cert server name" env:"BILIBILI_SERVER_NAME"` Endpoint string `yaml:"endpoint" env:"BILIBILI_ENDPOINT"` JwtSecret string `yaml:"jwt_secret" env:"BILIBILI_JWT_SECRET"` Scheme string `yaml:"scheme" lc:"grpc | http" env:"BILIBILI_SCHEME"` Tls bool `yaml:"tls" env:"BILIBILI_TLS"` CustomCAFile string `yaml:"custom_ca_file,omitempty" env:"BILIBILI_CUSTOM_CA_FILE"` TimeOut string `yaml:"time_out" env:"BILIBILI_TIME_OUT"` Consul Consul `yaml:"consul,omitempty" hc:"if use consul, must set the endpoint"` Etcd Etcd `yaml:"etcd,omitempty" hc:"if use etcd, must set the endpoints"` }
type VendorConfig ¶ added in v0.3.0
type VendorConfig struct {
Bilibili map[string]VendorBilibili `yaml:"bilibili" hc:"default use local vendor"`
}
func DefaultVendorConfig ¶ added in v0.3.0
func DefaultVendorConfig() VendorConfig
Click to show internal directories.
Click to hide internal directories.