api/config/getEnv.go

25 lines
365 B
Go
Raw Permalink Normal View History

2025-07-06 17:59:18 +03:00
package config
import (
"os"
"strconv"
)
func getEnv(key, fallback string) string {
if value, ok := os.LookupEnv(key); ok {
return value
}
return fallback
}
func getEnvInt(key string, fallback int) int {
if value, ok := os.LookupEnv(key); ok {
num, err := strconv.Atoi(value)
if err != nil {
return fallback
}
return num
}
return fallback
}