mirror of
https://github.com/openziti/zrok.git
synced 2025-01-23 06:19:04 +01:00
better index path configurability (#128)
This commit is contained in:
parent
728ae4b7b0
commit
7a1d491b99
@ -11,8 +11,8 @@ import (
|
||||
)
|
||||
|
||||
type FileSourceConfig struct {
|
||||
Path string
|
||||
DataPath string
|
||||
Path string
|
||||
IndexPath string
|
||||
}
|
||||
|
||||
func loadFileSourceConfig(v interface{}, opts *cf.Options) (interface{}, error) {
|
||||
@ -38,10 +38,9 @@ func (s *fileSource) Start(events chan map[string]interface{}) (join chan struct
|
||||
}
|
||||
_ = f.Close()
|
||||
|
||||
idxPath := s.cfg.Path + ".idx"
|
||||
idxF, err := os.OpenFile(idxPath, os.O_CREATE|os.O_RDWR, os.ModePerm)
|
||||
idxF, err := os.OpenFile(s.indexPath(), os.O_CREATE|os.O_RDWR, os.ModePerm)
|
||||
if err != nil {
|
||||
return nil, errors.Wrapf(err, "error opening '%v'", idxPath)
|
||||
return nil, errors.Wrapf(err, "error opening '%v'", s.indexPath())
|
||||
}
|
||||
|
||||
pos := int64(0)
|
||||
@ -98,3 +97,11 @@ func (s *fileSource) tail(pos int64, events chan map[string]interface{}, idxF *o
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (s *fileSource) indexPath() string {
|
||||
if s.cfg.IndexPath == "" {
|
||||
return s.cfg.Path + ".idx"
|
||||
} else {
|
||||
return s.cfg.IndexPath
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user