@@ -18,46 +18,46 @@ type Configurator interface {
1818
1919// GetEnvInt gets an int from the environment, falling back to the same field name in the config struct.
2020// If it doesn't exist in either, the function will log an error then exit 1
21- func GetEnvInt (c any , field string ) int {
21+ func GetEnvInt (config Configurator , field string ) int {
2222 defer func () {
2323 if r := recover (); r != nil {
2424 log .Fatalln (r )
2525 }
2626 }()
2727 value , err := strconv .Atoi (os .Getenv (field ))
2828 if err != nil {
29- value = getInt (c , field )
29+ value = getInt (config , field )
3030 }
3131 return value
3232}
3333
3434// GetEnvBool gets a bool from the environment, falling back to the same field name in the config struct.
3535// If it doesn't exist in either, the function will log an error then exit 1
36- func GetEnvBool (c any , field string ) bool {
36+ func GetEnvBool (config Configurator , field string ) bool {
3737 defer func () {
3838 if r := recover (); r != nil {
3939 log .Fatalln (r )
4040 }
4141 }()
4242 value , exists := os .LookupEnv (field )
4343 if ! exists {
44- return getBool (c , field )
44+ return getBool (config , field )
4545 }
4646 v := strings .ToLower (value )
4747 return ! (v == "off" || v == "false" || v == "0" )
4848}
4949
5050// GetEnvString gets a string from the environment, falling back to the same field name in the config struct.
5151// If it doesn't exist in either, the function will log an error then exit 1
52- func GetEnvString (c any , field string ) string {
52+ func GetEnvString (config Configurator , field string ) string {
5353 defer func () {
5454 if r := recover (); r != nil {
5555 log .Fatalln (r )
5656 }
5757 }()
5858 value , exists := os .LookupEnv (field )
5959 if ! exists {
60- value = getString (c , field )
60+ value = getString (config , field )
6161 }
6262 return value
6363}
0 commit comments