This commit is contained in:
@@ -9,6 +9,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
@@ -56,21 +57,15 @@ func envBool(k string) bool {
|
||||
v := strings.ToLower(os.Getenv(k))
|
||||
return v == "1" || v == "true" || v == "yes"
|
||||
}
|
||||
|
||||
func envInt64(k string, def int64) int64 {
|
||||
if v := os.Getenv(k); v != "" {
|
||||
var x int64
|
||||
_, _ = fmtSscanf(v, &x)
|
||||
if x, err := strconv.ParseInt(v, 10, 64); err == nil {
|
||||
return x
|
||||
}
|
||||
}
|
||||
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 {
|
||||
cfg := Config{
|
||||
|
||||
Reference in New Issue
Block a user