dataRT/config/url.go

73 lines
1.3 KiB
Go

package config
type urlConfig struct {
Scheme string `json:"scheme" yaml:"scheme"`
Host string `json:"host" yaml:"host"` // host or host:port
Path string `json:"path" yaml:"path"`
Timeout int `json:"timeout" yaml:"timeout"`
}
func NewURLConfig() *urlConfig {
return new(urlConfig)
}
func (conf *urlConfig) GetScheme() string {
if conf == nil {
panic("url config is nil")
}
return conf.Scheme
}
func (conf *urlConfig) SetScheme(scheme string) {
if conf == nil {
panic("url config is nil")
}
conf.Scheme = scheme
}
func (conf *urlConfig) GetHost() string {
if conf == nil {
panic("url config is nil")
}
return conf.Host
}
func (conf *urlConfig) SetHost(host string) {
if conf == nil {
panic("url config is nil")
}
conf.Host = host
}
func (conf *urlConfig) GetPath() string {
if conf == nil {
panic("url config is nil")
}
return conf.Path
}
func (conf *urlConfig) SetPath(path string) {
if conf == nil {
panic("url config is nil")
}
conf.Path = path
}
func (conf *urlConfig) GetTimeout() int {
if conf == nil {
panic("url config is nil")
}
return conf.Timeout
}
func (conf *urlConfig) SetTimeout(timeout int) {
if conf == nil {
panic("url config is nil")
}
conf.Timeout = timeout
}
func urlConfigName() string {
return "url.json"
}