Support integer config values

This commit is contained in:
Philipp Wolfer 2024-01-13 14:11:58 +01:00
parent 8c459f4d2f
commit 97e93553a1
No known key found for this signature in database
GPG key ID: 8FDF744D4919943B
3 changed files with 37 additions and 0 deletions

View file

@ -62,6 +62,14 @@ func (c *ServiceConfig) GetBool(key string, defaultValue bool) bool {
}
}
func (c *ServiceConfig) GetInt(key string, defaultValue int) int {
if c.IsSet(key) {
return cast.ToInt(c.ConfigValues[key])
} else {
return defaultValue
}
}
func (c *ServiceConfig) IsSet(key string) bool {
_, ok := c.ConfigValues[key]
return ok