Skip to content

Commit

Permalink
chore(env): adjust simple example
Browse files Browse the repository at this point in the history
Signed-off-by: lvlcn-t <[email protected]>
  • Loading branch information
lvlcn-t committed Oct 24, 2024
1 parent 09226b5 commit a43f8fc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion example/env/simple/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@ func main() {
fmt.Println(env.MustGet[int]("MY_INT"))
fmt.Println(env.MustGet("MY_DURATION", time.ParseDuration))

// Read a couple of environment variables that are necessary but you want to handle the errors gracefully.
// Read an environment variable that is necessary but you want to handle the error gracefully.
value, err := env.Get[bool]("MY_BOOL").NoFallback().Value()
if err != nil {
fmt.Println("Failed to get MY_BOOL:", err)
return
}
fmt.Println(value)
}

0 comments on commit a43f8fc

Please sign in to comment.