forked from mtusi2026/mtusi2026lab3
lab3 na4
This commit is contained in:
@@ -3,6 +3,7 @@ package config
|
||||
import (
|
||||
"os"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -10,6 +11,11 @@ func GetEnv(key, fallback string) string {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
return v
|
||||
}
|
||||
if p := os.Getenv(key + "_FILE"); p != "" {
|
||||
if b, err := os.ReadFile(p); err == nil {
|
||||
return strings.TrimSpace(string(b))
|
||||
}
|
||||
}
|
||||
return fallback
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user