Fix data path
This commit is contained in:
@@ -10,7 +10,7 @@ const folderNameValues = "values"
|
||||
|
||||
// buildFolderPathForBundles builds the folder path for storing settings bundles. If mkdir is true, folders in the path will be created if necessary.
|
||||
func (s Store) buildFolderPathForBundles(mkdir bool) string {
|
||||
folderPath := filepath.Join(s.mountPath, folderNameBundles)
|
||||
folderPath := filepath.Join(s.dataPath, folderNameBundles)
|
||||
if mkdir {
|
||||
s.ensureFolderExists(folderPath)
|
||||
}
|
||||
@@ -25,7 +25,7 @@ func (s Store) buildFilePathForBundle(bundleID string, mkdir bool) string {
|
||||
|
||||
// buildFolderPathForValues builds the folder path for storing settings values. If mkdir is true, folders in the path will be created if necessary.
|
||||
func (s Store) buildFolderPathForValues(mkdir bool) string {
|
||||
folderPath := filepath.Join(s.mountPath, folderNameValues)
|
||||
folderPath := filepath.Join(s.dataPath, folderNameValues)
|
||||
if mkdir {
|
||||
s.ensureFolderExists(folderPath)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package store
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path"
|
||||
|
||||
olog "github.com/owncloud/ocis-pkg/v2/log"
|
||||
"github.com/owncloud/ocis-settings/pkg/config"
|
||||
@@ -18,8 +17,8 @@ var (
|
||||
|
||||
// Store interacts with the filesystem to manage settings information
|
||||
type Store struct {
|
||||
mountPath string
|
||||
Logger olog.Logger
|
||||
dataPath string
|
||||
Logger olog.Logger
|
||||
}
|
||||
|
||||
// New creates a new store
|
||||
@@ -32,16 +31,16 @@ func New(cfg *config.Config) settings.Manager {
|
||||
),
|
||||
}
|
||||
|
||||
dest := path.Join(cfg.Storage.RootMountPath, Name)
|
||||
if _, err := os.Stat(dest); err != nil {
|
||||
s.Logger.Info().Msgf("creating container on %v", dest)
|
||||
err := os.MkdirAll(dest, 0700)
|
||||
if _, err := os.Stat(cfg.Storage.DataPath); err != nil {
|
||||
s.Logger.Info().Msgf("creating container on %v", cfg.Storage.DataPath)
|
||||
err := os.MkdirAll(cfg.Storage.DataPath, 0700)
|
||||
|
||||
if err != nil {
|
||||
s.Logger.Err(err).Msgf("providing container on %v", dest)
|
||||
s.Logger.Err(err).Msgf("providing container on %v", cfg.Storage.DataPath)
|
||||
}
|
||||
}
|
||||
|
||||
s.mountPath = dest
|
||||
s.dataPath = cfg.Storage.DataPath
|
||||
return &s
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user