Skip to content

Commit

Permalink
default to "" for Config.GetString
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmasek committed Jan 11, 2025
1 parent 4642937 commit 54f69e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions conf/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ func (config *Config) get(key string) interface{} {

func (config *Config) GetString(key string) string {
val := config.get(key)
if val == nil {
return ""
}
strVal, ok := val.(string)
if ok {
return strVal
Expand Down
2 changes: 2 additions & 0 deletions storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
_ "embed"
"encoding/json"
"errors"
"log"
"os"
"path/filepath"
"testing"
Expand Down Expand Up @@ -330,6 +331,7 @@ func InitDB(dbPath string) (Storage, error) {
}
dbPath = filepath.Join(homedir, "beacon.db")
}
log.Println("DB path:", dbPath)
db, err := NewSQLStorage(dbPath)
if err != nil {
return nil, err
Expand Down

0 comments on commit 54f69e4

Please sign in to comment.