mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 05:37:05 +02:00
Support integer config values
This commit is contained in:
parent
8c459f4d2f
commit
97e93553a1
3 changed files with 37 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue