mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-04-22 16:28:01 -04:00
Create data subfolders on disk repo start
This commit is contained in:
@@ -25,6 +25,19 @@ type DiskRepo struct {
|
||||
|
||||
// NewDiskRepo creates a new disk repo
|
||||
func NewDiskRepo(serviceID string, cfg *config.Config, log olog.Logger) DiskRepo {
|
||||
paths := []string{
|
||||
filepath.Join(cfg.Repo.Disk.Path, accountsFolder),
|
||||
filepath.Join(cfg.Repo.Disk.Path, groupsFolder),
|
||||
}
|
||||
for i := range paths {
|
||||
if _, err := os.Stat(paths[i]); err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
if err = os.MkdirAll(paths[i], 0700); err != nil {
|
||||
log.Fatal().Err(err).Msgf("could not create data folder %v", paths[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return DiskRepo{
|
||||
serviceID: serviceID,
|
||||
cfg: cfg,
|
||||
|
||||
Reference in New Issue
Block a user