chore: change fs get and list resp

This commit is contained in:
Noah Hsu
2022-06-27 21:34:13 +08:00
parent c8f10703b7
commit 7903ed1f52
4 changed files with 27 additions and 14 deletions

View File

@ -5,8 +5,15 @@ import (
"strconv"
)
func GetByKey(key string) string {
return db.GetSettingsMap()[key]
func GetByKey(key string, defaultValue ...string) string {
val, ok := db.GetSettingsMap()[key]
if !ok {
if len(defaultValue) > 0 {
return defaultValue[0]
}
return ""
}
return val
}
func GetIntSetting(key string, defaultVal int) int {