mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-30 05:37:05 +02:00
Allow default values for boolean config settings
This commit is contained in:
parent
6ac2b4f142
commit
7666ca53a7
4 changed files with 10 additions and 12 deletions
|
@ -54,8 +54,12 @@ func (c *ServiceConfig) GetString(key string) string {
|
|||
return cast.ToString(c.ConfigValues[key])
|
||||
}
|
||||
|
||||
func (c *ServiceConfig) GetBool(key string) bool {
|
||||
return cast.ToBool(c.ConfigValues[key])
|
||||
func (c *ServiceConfig) GetBool(key string, defaultValue bool) bool {
|
||||
if c.IsSet(key) {
|
||||
return cast.ToBool(c.ConfigValues[key])
|
||||
} else {
|
||||
return defaultValue
|
||||
}
|
||||
}
|
||||
|
||||
func (c *ServiceConfig) IsSet(key string) bool {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue