defaults dont work for conf
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user