Files
query-orchestration/internal/env/get.go
T
Michael McGuinness d53611c6c5 passedTestingThreshhold
2024-12-24 18:11:25 +00:00

26 lines
366 B
Go

package env
import (
"fmt"
"log"
"os"
)
func GetPanic(name string) string {
value, err := Get(name)
if err != nil {
log.Panic(err.Error())
}
return value
}
func Get(name string) (string, error) {
value, exists := os.LookupEnv(name)
if !exists || value == "" {
return "", fmt.Errorf("environment variable not set: %s", name)
}
return value, nil
}