PUBLICIP_PERIOD environment variable

This commit is contained in:
Quentin McGaw
2020-07-16 01:12:54 +00:00
parent 002ffacd35
commit 51af8d1ab0
6 changed files with 102 additions and 11 deletions

View File

@@ -0,0 +1,17 @@
package params
import (
"time"
libparams "github.com/qdm12/golibs/params"
)
// GetPublicIPPeriod obtains the period to fetch the IP address periodically.
// Set to 0 to disable
func (r *reader) GetPublicIPPeriod() (period time.Duration, err error) {
s, err := r.envParams.GetEnv("PUBLICIP_PERIOD", libparams.Default("12h"))
if err != nil {
return 0, err
}
return time.ParseDuration(s)
}