mirror of
https://github.com/project-zot/zot.git
synced 2025-01-20 22:52:51 -05:00
24 lines
370 B
Go
24 lines
370 B
Go
|
package bolt
|
||
|
|
||
|
import (
|
||
|
"path"
|
||
|
"time"
|
||
|
|
||
|
bolt "go.etcd.io/bbolt"
|
||
|
)
|
||
|
|
||
|
type DBParameters struct {
|
||
|
RootDir string
|
||
|
}
|
||
|
|
||
|
func GetBoltDriver(params DBParameters) (*bolt.DB, error) {
|
||
|
const perms = 0o600
|
||
|
|
||
|
boltDB, err := bolt.Open(path.Join(params.RootDir, "repo.db"), perms, &bolt.Options{Timeout: time.Second * 10})
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
|
||
|
return boltDB, nil
|
||
|
}
|