Fail loudly on set-but-unparseable env config values (closes #80) (#92)
Some checks failed
check / check (push) Has been cancelled
Some checks failed
check / check (push) Has been cancelled
Defaults now apply only to unset or empty environment variables; a set-but- unparseable value aborts startup with an error naming the key and the value. envInt is gone, envBool parses with strconv.ParseBool, and PORT is bounded.
This commit was merged in pull request #92.
This commit is contained in:
20
internal/config/export_test.go
Normal file
20
internal/config/export_test.go
Normal file
@@ -0,0 +1,20 @@
|
||||
package config
|
||||
|
||||
// This file exposes the unexported environment parsing helpers to
|
||||
// the external config_test package so each helper can be covered by
|
||||
// its own table-driven test without weakening the package API.
|
||||
|
||||
// EnvBoolForTest exposes envBool.
|
||||
func EnvBoolForTest(key string, defaultValue bool) (bool, error) {
|
||||
return envBool(key, defaultValue)
|
||||
}
|
||||
|
||||
// EnvPositiveIntForTest exposes envPositiveInt.
|
||||
func EnvPositiveIntForTest(key string, defaultValue int) (int, error) {
|
||||
return envPositiveInt(key, defaultValue)
|
||||
}
|
||||
|
||||
// EnvPortForTest exposes envPort.
|
||||
func EnvPortForTest(key string, defaultValue int) (int, error) {
|
||||
return envPort(key, defaultValue)
|
||||
}
|
||||
Reference in New Issue
Block a user