Files
gluetun/internal/storage/storage.go
Quentin McGaw (desktop) 21f4cf7ab5 Maint: do not mock os functions
- Use filepaths with /tmp for tests instead
- Only mock functions where filepath can't be specified such as user.Lookup
2021-07-23 16:06:19 +00:00

26 lines
625 B
Go

// Package storage defines interfaces to interact with the files persisted such as the list of servers.
package storage
import (
"github.com/qdm12/gluetun/internal/models"
"github.com/qdm12/golibs/logging"
)
type Storage interface {
// Passing an empty filepath disables writing to a file
SyncServers(hardcodedServers models.AllServers) (allServers models.AllServers, err error)
FlushToFile(servers models.AllServers) error
}
type storage struct {
logger logging.Logger
filepath string
}
func New(logger logging.Logger, filepath string) Storage {
return &storage{
logger: logger,
filepath: filepath,
}
}