Commit 1362db1c authored by Jordan Sissel's avatar Jordan Sissel

- use `` string literals for struct tags. Lets me do `json:"ssl

  certificate"` for worded json keys
parent 7a564696
......@@ -4,21 +4,25 @@ import (
"encoding/json"
"os"
"log"
"time"
)
type Config struct {
Network NetworkConfig "json:network"
Files []FileConfig "json:files"
Network NetworkConfig `json:network`
Files []FileConfig `json:files`
}
type NetworkConfig struct {
Servers []string "json:servers"
SSLCertificate string "json:ssl certificate"
}
Servers []string `json:servers`
SSLCertificate string `json:"ssl certificate"`
SSLKey string `json:"ssl key"`
SSLCA string `json:"ssl ca"`
Timeout time.Duration `json:timeout`
}
type FileConfig struct {
Paths []string "json:paths"
Fields map[string]string "json:fields"
Paths []string `json:paths`
Fields map[string]string `json:fields`
}
func LoadConfig(path string) (config Config, err error) {
......@@ -45,5 +49,9 @@ func LoadConfig(path string) (config Config, err error) {
return
}
if config.Network.Timeout == 0 {
config.Network.Timeout = 5 * time.Second
}
return
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment