mirror of
https://github.com/tuna/tunasync.git
synced 2025-04-20 20:22:46 +00:00
feature(worker): added worker http server config
This commit is contained in:
parent
731fba842f
commit
8b56fda1e9
@ -49,6 +49,7 @@ func (p *ProviderEnum) UnmarshalText(text []byte) error {
|
|||||||
type Config struct {
|
type Config struct {
|
||||||
Global globalConfig `toml:"global"`
|
Global globalConfig `toml:"global"`
|
||||||
Manager managerConfig `toml:"manager"`
|
Manager managerConfig `toml:"manager"`
|
||||||
|
Server serverConfig `toml:"server"`
|
||||||
Mirrors []mirrorConfig `toml:"mirrors"`
|
Mirrors []mirrorConfig `toml:"mirrors"`
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,6 +67,14 @@ type managerConfig struct {
|
|||||||
Token string `toml:"token"`
|
Token string `toml:"token"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type serverConfig struct {
|
||||||
|
Hostname string `toml:"hostname"`
|
||||||
|
Addr string `toml:"listen_addr"`
|
||||||
|
Port int `toml:"listen_port"`
|
||||||
|
SSLCert string `toml:"ssl_cert"`
|
||||||
|
SSLKey string `toml:"ssl_key"`
|
||||||
|
}
|
||||||
|
|
||||||
type mirrorConfig struct {
|
type mirrorConfig struct {
|
||||||
Name string `toml:"name"`
|
Name string `toml:"name"`
|
||||||
Provider ProviderEnum `toml:"provider"`
|
Provider ProviderEnum `toml:"provider"`
|
||||||
|
@ -21,6 +21,13 @@ interval = 240
|
|||||||
api_base = "https://127.0.0.1:5000"
|
api_base = "https://127.0.0.1:5000"
|
||||||
token = "some_token"
|
token = "some_token"
|
||||||
|
|
||||||
|
[server]
|
||||||
|
hostname = "worker1.example.com"
|
||||||
|
listen_addr = "127.0.0.1"
|
||||||
|
listen_port = 6000
|
||||||
|
ssl_cert = "/etc/tunasync.d/worker1.cert"
|
||||||
|
ssl_key = "/etc/tunasync.d/worker1.key"
|
||||||
|
|
||||||
[[mirrors]]
|
[[mirrors]]
|
||||||
name = "AOSP"
|
name = "AOSP"
|
||||||
provider = "command"
|
provider = "command"
|
||||||
@ -68,6 +75,7 @@ exclude_file = "/etc/tunasync.d/fedora-exclude.txt"
|
|||||||
So(cfg.Global.MirrorDir, ShouldEqual, "/data/mirrors")
|
So(cfg.Global.MirrorDir, ShouldEqual, "/data/mirrors")
|
||||||
|
|
||||||
So(cfg.Manager.APIBase, ShouldEqual, "https://127.0.0.1:5000")
|
So(cfg.Manager.APIBase, ShouldEqual, "https://127.0.0.1:5000")
|
||||||
|
So(cfg.Server.Hostname, ShouldEqual, "worker1.example.com")
|
||||||
|
|
||||||
m := cfg.Mirrors[0]
|
m := cfg.Mirrors[0]
|
||||||
So(m.Name, ShouldEqual, "AOSP")
|
So(m.Name, ShouldEqual, "AOSP")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user