defaults dont work for conf

This commit is contained in:
Bel LaPointe
2019-02-23 18:54:33 -07:00
parent 73de851e81
commit 2099ae50c6
5 changed files with 66 additions and 3 deletions

View File

@@ -2,6 +2,8 @@ package config
import (
"local/rproxy3/storage/packable"
"log"
"strconv"
"strings"
)
@@ -52,3 +54,25 @@ func notEmpty(s ...string) bool {
}
return true
}
func GetRate() (int, int) {
r := packable.NewString()
conf.Get(nsConf, flagRate, r)
b := packable.NewString()
conf.Get(nsConf, flagBurst, b)
rate, _ := strconv.Atoi(r.String())
burst, _ := strconv.Atoi(b.String())
return rate, burst
}
func GetTimeout() int {
t := packable.NewString()
conf.Get(nsConf, flagTimeout, t)
timeout, _ := strconv.Atoi(t.String())
log.Printf("TIMEOUT t:%q, i:%v", t.String(), timeout)
return timeout
}