dreamfactory_cmd/cmd/v2/lib/storage/storage.go
2023-06-09 21:58:02 +08:00

30 lines
506 B
Go

package storage
import "path/filepath"
const (
storageRootName = "storage"
configFileName = "config.json"
ID = "zhaocy.df"
Version = "zhaocy/df/v1"
)
type Storage interface {
Root() string
ConfigStorage
}
type ConfigStorage interface {
LoadConfig() (*Config, error)
StoreConfig(s *Config) error
}
func storageRootPath(s Storage) string {
return filepath.Join(s.Root(), storageRootName)
}
func configPath(s Storage) string {
return filepath.Join(storageRootPath(s), configFileName)
}