We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3b836e5 commit f50ce90Copy full SHA for f50ce90
viper.go
@@ -1197,6 +1197,17 @@ func (v *Viper) BindEnv(input ...string) error {
1197
return nil
1198
}
1199
1200
+// MustBindEnv wraps BindEnv in a panic.
1201
+// If there is an error binding an environment variable, MustBindEnv will
1202
+// panic.
1203
+func MustBindEnv(input ...string) { v.MustBindEnv(input...) }
1204
+
1205
+func (v *Viper) MustBindEnv(input ...string) {
1206
+ if err := v.BindEnv(input...); err != nil {
1207
+ panic(fmt.Sprintf("error while binding environment variable: %v", err))
1208
+ }
1209
+}
1210
1211
// Given a key, find the value.
1212
//
1213
// Viper will check to see if an alias exists first.
0 commit comments