summaryrefslogtreecommitdiff
path: root/plugins/kv/drivers/boltdb/config.go
blob: 0beb209b0e3d7eeaede2b312c6fbc27c9c40f84d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package boltdb

type Config struct {
	// File is boltDB file. No need to create it by your own,
	// boltdb driver is able to create the file, or read existing
	File string
	// Bucket to store data in boltDB
	bucket string
	// db file permissions
	Permissions int
	// timeout
	Interval int `mapstructure:"interval"`
}

// InitDefaults initializes default values for the boltdb
func (s *Config) InitDefaults() {
	s.bucket = "default"

	if s.File == "" {
		s.File = "rr.db" // default file name
	}

	if s.Permissions == 0 {
		s.Permissions = 0777 // free for all
	}

	if s.Interval == 0 {
		s.Interval = 60 // default is 60 seconds timeout
	}
}