-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
52 lines (44 loc) · 1.42 KB
/
config.go
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package file
import (
"github.com/D3rus/go-library/file/namer"
"github.com/Diez37/units/size"
"os"
"path/filepath"
)
const (
DirectoryFieldName = "buffer.file.directory"
NamePatternFieldName = "buffer.file.name_pattern"
RotationStrategyFieldName = "buffer.file.rotation.strategy"
RotationSizeHumanReadableFieldName = "buffer.file.rotation.size"
CompressorFieldName = "buffer.file.compressor"
AutoDeleteFieldName = "buffer.file.auto_delete"
DayRotationStrategy = "day"
HourRotationStrategy = "hour"
SizeRotationStrategy = "size"
CompressorNone = "none"
CompressorTrue = "true"
CompressorTarGZ = "tar_gz"
CompressorZIP = "zip"
NamePatternDefault = "data_" + namer.UnixTimeNanoPattern + ".bin"
RotationStrategyDefault = SizeRotationStrategy
RotationSizeDefault = 10 * size.MiB
CompressorDefault = CompressorNone
AutoDeleteDefault = false
)
var (
DirectoryDefault = filepath.Join(os.TempDir(), "go_app")
RotationSizeHumanReadableDefault = size.FormatBinary(RotationSizeDefault)
)
type Config struct {
Directory string
NamePattern string
NameForMetric string
RotationStrategy string
RotationSizeHumanReadable string
RotationSize uint64
Compressor string
AutoDelete bool
}
func NewConfig() *Config {
return &Config{}
}