mirror of https://github.com/synctv-org/synctv
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.
59 lines
1.0 KiB
Go
59 lines
1.0 KiB
Go
package conf
|
|
|
|
import (
|
|
"github.com/synctv-org/synctv/utils"
|
|
"github.com/zijiren233/stream"
|
|
"gopkg.in/yaml.v3"
|
|
)
|
|
|
|
type Config struct {
|
|
// Global
|
|
Global GlobalConfig `yaml:"global"`
|
|
|
|
// 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{
|
|
// Global
|
|
Global: DefaultGlobalConfig(),
|
|
|
|
// Log
|
|
Log: DefaultLogConfig(),
|
|
|
|
// Server
|
|
Server: DefaultServerConfig(),
|
|
|
|
// Jwt
|
|
Jwt: DefaultJwtConfig(),
|
|
|
|
// Rtmp
|
|
Rtmp: DefaultRtmpConfig(),
|
|
|
|
// Proxy
|
|
Proxy: DefaultProxyConfig(),
|
|
}
|
|
}
|