Add torrent addr to config

master
Bel LaPointe 2018-10-13 09:56:37 -06:00
parent 0640e065fa
commit 47284c1106
1 changed files with 8 additions and 4 deletions

View File

@ -10,20 +10,24 @@ import (
const cdbpath = "DBPath" const cdbpath = "DBPath"
const port = "port" const port = "port"
const toraddr = "toraddr"
type Config struct { type Config struct {
DBPath string DBPath string
Port string Port string
TorAddr string
} }
func New() *Config { func New() *Config {
lookups := make(map[string]*string) lookups := make(map[string]*string)
add(cdbpath, path.Join(os.Getenv("MNT"), "db.db"), lookups) add(cdbpath, path.Join(os.Getenv("MNT"), "db.db"), lookups)
add(port, ":9101", lookups) add(port, ":9101", lookups)
add(toraddr, "http://192.168.0.86:9091/transmission/rpc", lookups)
flag.Parse() flag.Parse()
return &Config{ return &Config{
DBPath: *lookups[cdbpath], DBPath: *lookups[cdbpath],
Port: *lookups[port], Port: *lookups[port],
TorAddr: *lookups[toraddr],
} }
} }