You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
synctv/internal/conf/config.go

53 lines
929 B
Go

package conf
import (
"github.com/synctv-org/synctv/utils"
"github.com/zijiren233/stream"
"gopkg.in/yaml.v3"
)
type Config struct {
// Log
Log LogConfig `yaml:"log"`
// Server
Server ServerConfig `yaml:"server"`
// Jwt
Jwt JwtConfig `yaml:"jwt"`
// Rtmp
Rtmp RtmpConfig `yaml:"rtmp" hc:"you can use rtmp to publish live"`
// Proxy
Proxy ProxyConfig `yaml:"proxy" hc:"you can use proxy to proxy movie and live when custom headers or network is slow to connect to origin server"`
}
func (c *Config) Save(file string) error {
return utils.WriteYaml(file, c)
}
func (c *Config) String() string {
o, _ := yaml.Marshal(c)
return stream.BytesToString(o)
}
func DefaultConfig() *Config {
return &Config{
// Log
Log: DefaultLogConfig(),
// Server
Server: DefaultServerConfig(),
// Jwt
Jwt: DefaultJwtConfig(),
// Rtmp
Rtmp: DefaultRtmpConfig(),
// Proxy
Proxy: DefaultProxyConfig(),
}
}