Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0f776a154 |
@@ -191,9 +191,9 @@ func parseInt(key string, minimum int, value *int) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// parseFloat sets *value to the setting key read as a floating-point
|
||||
// number. It returns an error when the value does not parse or is not a
|
||||
// finite number above zero.
|
||||
// parseFloat sets *value to the setting key read as a decimal number. It
|
||||
// returns an error when the value does not parse or is not a finite
|
||||
// number above zero.
|
||||
func parseFloat(key string, value *float64) error {
|
||||
raw := viper.GetString(key)
|
||||
|
||||
|
||||
@@ -78,28 +78,26 @@ func TestUnsetSettingsKeepDefaults(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestValidSettingsAreUsed(t *testing.T) {
|
||||
// Each whole number is the lowest value its setting allows, and 1ns
|
||||
// is the shortest duration allowed.
|
||||
t.Setenv("PORT", "0")
|
||||
t.Setenv("MAX_MESSAGE_SIZE", "1")
|
||||
t.Setenv("PORT", "9000")
|
||||
t.Setenv("MAX_MESSAGE_SIZE", "1024")
|
||||
t.Setenv("NEOIRC_HASHCASH_BITS", "0")
|
||||
t.Setenv("LOGIN_RATE_BURST", "1")
|
||||
t.Setenv("LOGIN_RATE_BURST", "10")
|
||||
t.Setenv("LOGIN_RATE_LIMIT", "0.5")
|
||||
t.Setenv("DEBUG", "true")
|
||||
t.Setenv("MAINTENANCE_MODE", "true")
|
||||
t.Setenv("MESSAGE_MAX_AGE", "1ns")
|
||||
t.Setenv("MESSAGE_MAX_AGE", "24h")
|
||||
t.Setenv("QUEUE_MAX_AGE", "1h30m")
|
||||
t.Setenv("SESSION_IDLE_TIMEOUT", "45m")
|
||||
|
||||
want := settings{
|
||||
Port: 0,
|
||||
MaxMessageSize: 1,
|
||||
Port: 9000,
|
||||
MaxMessageSize: 1024,
|
||||
HashcashBits: 0,
|
||||
LoginRateBurst: 1,
|
||||
LoginRateBurst: 10,
|
||||
LoginRateLimit: 0.5,
|
||||
Debug: true,
|
||||
MaintenanceMode: true,
|
||||
MessageMaxAge: "1ns",
|
||||
MessageMaxAge: "24h",
|
||||
QueueMaxAge: "1h30m",
|
||||
SessionIdleTimeout: "45m",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user