3 Star 0 Fork 0

Gitee 极速下载 / gitlab-workhorsesource

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://gitlab.com/gitlab-org/gitlab-workhorse
克隆/下载
config.go 1.46 KB
一键复制 编辑 原始数据 按行查看 历史
package config
import (
"net/url"
"time"
"github.com/BurntSushi/toml"
)
type TomlURL struct {
url.URL
}
func (u *TomlURL) UnmarshalText(text []byte) error {
temp, err := url.Parse(string(text))
u.URL = *temp
return err
}
type TomlDuration struct {
time.Duration
}
func (d *TomlDuration) UnmarshalTest(text []byte) error {
temp, err := time.ParseDuration(string(text))
d.Duration = temp
return err
}
type RedisConfig struct {
URL TomlURL
Sentinel []TomlURL
SentinelMaster string
Password string
DB *int
ReadTimeout *TomlDuration
WriteTimeout *TomlDuration
KeepAlivePeriod *TomlDuration
MaxIdle *int
MaxActive *int
}
type Config struct {
Redis *RedisConfig `toml:"redis"`
Backend *url.URL `toml:"-"`
Version string `toml:"-"`
DocumentRoot string `toml:"-"`
DevelopmentMode bool `toml:"-"`
Socket string `toml:"-"`
ProxyHeadersTimeout time.Duration `toml:"-"`
APILimit uint `toml:"-"`
APIQueueLimit uint `toml:"-"`
APIQueueTimeout time.Duration `toml:"-"`
APICILongPollingDuration time.Duration `toml:"-"`
}
// LoadConfig from a file
func LoadConfig(filename string) (*Config, error) {
cfg := &Config{}
if _, err := toml.DecodeFile(filename, cfg); err != nil {
return nil, err
}
return cfg, nil
}
1
https://gitee.com/mirrors/gitlab-workhorsesource.git
git@gitee.com:mirrors/gitlab-workhorsesource.git
mirrors
gitlab-workhorsesource
gitlab-workhorsesource
v3.5.0

搜索帮助