fix(config): add config loading functions and tests, also fix config issues

This commit is contained in:
hexxa 2022-01-28 22:11:27 +08:00 committed by Hexxa
parent 67da1ea0eb
commit 32a003d789
11 changed files with 42 additions and 69 deletions

View file

@ -16,6 +16,7 @@ import (
var (
ErrBucketNotFound = errors.New("bucket not found")
DBName = "quickshare.db"
)
type BoltPvd struct {
@ -25,7 +26,7 @@ type BoltPvd struct {
}
func New(dbPath string, maxStrLen int) *BoltPvd {
boltPath := path.Join(path.Clean(dbPath), "quickshare.db")
boltPath := path.Join(path.Clean(dbPath), DBName)
db, err := bolt.Open(boltPath, 0600, &bolt.Options{Timeout: 1 * time.Second})
if err != nil {
panic(err)