This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
@@ -56,21 +57,15 @@ func envBool(k string) bool {
|
|||||||
v := strings.ToLower(os.Getenv(k))
|
v := strings.ToLower(os.Getenv(k))
|
||||||
return v == "1" || v == "true" || v == "yes"
|
return v == "1" || v == "true" || v == "yes"
|
||||||
}
|
}
|
||||||
|
|
||||||
func envInt64(k string, def int64) int64 {
|
func envInt64(k string, def int64) int64 {
|
||||||
if v := os.Getenv(k); v != "" {
|
if v := os.Getenv(k); v != "" {
|
||||||
var x int64
|
if x, err := strconv.ParseInt(v, 10, 64); err == nil {
|
||||||
_, _ = fmtSscanf(v, &x)
|
|
||||||
return x
|
return x
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return def
|
return def
|
||||||
}
|
}
|
||||||
func fmtSscanf(s string, p *int64) (int, error) { return fmtSscanfImpl(s, p) }
|
|
||||||
|
|
||||||
// tiny wrapper to avoid importing fmt at top-level; keeps imports tidy
|
|
||||||
func fmtSscanfImpl(s string, p *int64) (int, error) { return fmtSscanfReal(s, p) }
|
|
||||||
|
|
||||||
//go:linkname fmtSscanfReal fmt.Sscanf
|
|
||||||
func fmtSscanfReal(s string, p *int64) (int, error)
|
|
||||||
|
|
||||||
func loadConfig() Config {
|
func loadConfig() Config {
|
||||||
cfg := Config{
|
cfg := Config{
|
||||||
|
|||||||
Reference in New Issue
Block a user