Skip to content

Commit

Permalink
panic
Browse files Browse the repository at this point in the history
  • Loading branch information
bthuillier committed Oct 2, 2024
1 parent 82ce9d5 commit 35e598a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion resource/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"io"
"log"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -127,7 +128,11 @@ func expandEnv(data []byte) []byte {
keyAndDefault := strings.SplitN(key, ":-", 2)
key = keyAndDefault[0]

v := os.Getenv(key)
v, ok := os.LookupEnv(key)
if !ok && len(keyAndDefault) == 1 {
log.Fatalf("environment variable %s not found", key)
panic(fmt.Sprintf("environment variable %s not found", key))
}
if v == "" && len(keyAndDefault) == 2 {
v = keyAndDefault[1] // Set value to the default.
}
Expand Down

0 comments on commit 35e598a

Please sign in to comment.