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 port = "port"
const toraddr = "toraddr"
type Config struct {
DBPath string
Port string
DBPath string
Port string
TorAddr string
}
func New() *Config {
lookups := make(map[string]*string)
add(cdbpath, path.Join(os.Getenv("MNT"), "db.db"), lookups)
add(port, ":9101", lookups)
add(toraddr, "http://192.168.0.86:9091/transmission/rpc", lookups)
flag.Parse()
return &Config{
DBPath: *lookups[cdbpath],
Port: *lookups[port],
DBPath: *lookups[cdbpath],
Port: *lookups[port],
TorAddr: *lookups[toraddr],
}
}