Spaces:
Runtime error
Runtime error
Download utils/utils.go from lifedebugger/event-booking-api: direct link, hf CLI and curl.
- Browser
- Download file 406 Bytes
-
https://huggingface.co/spaces/lifedebugger/event-booking-api/resolve/main/utils/utils.go
- Command line
-
hf download hf://spaces/lifedebugger/event-booking-api/utils/utils.go
-
curl -L -o utils.go https://huggingface.co/spaces/lifedebugger/event-booking-api/resolve/main/utils/utils.go
406 Bytes
| package utils | |
| import ( | |
| "os" | |
| "strings" | |
| ) | |
| func Ptr[T any](v T) *T { | |
| return &v | |
| } | |
| func GetEnv(key string) string { | |
| // 1. Normal env | |
| if val := os.Getenv(key); val != "" { | |
| return val | |
| } | |
| // 2. File-based secret | |
| if file := os.Getenv(key + "_FILE"); file != "" { | |
| data, err := os.ReadFile(file) | |
| if err == nil { | |
| return strings.TrimSpace(string(data)) | |
| } else { | |
| panic(err) | |
| } | |
| } | |
| return "" | |
| } | |