Space Trash-bin expiration cli (#5500)

* add storage-users trash-bin cli
add task to clean up outdated trash-bin resources
add trash-bin cli purge-expired command to purge expired trash-bin resources
add purge-expired task tests
This commit is contained in:
Florian Schade
2023-02-10 12:04:47 +01:00
committed by GitHub
parent 9e73221a68
commit 5da3df8ffe
13 changed files with 650 additions and 0 deletions

View File

@@ -2,6 +2,7 @@ package defaults
import (
"path/filepath"
"time"
"github.com/owncloud/ocis/v2/ocis-pkg/config/defaults"
"github.com/owncloud/ocis/v2/ocis-pkg/shared"
@@ -87,6 +88,12 @@ func DefaultConfig() *config.Config {
Store: "memory",
Database: "users",
},
Tasks: config.Tasks{
PurgeTrashBin: config.PurgeTrashBin{
ProjectDeleteBefore: 30 * 24 * time.Hour,
PersonalDeleteBefore: 30 * 24 * time.Hour,
},
},
}
}
@@ -139,6 +146,10 @@ func EnsureDefaults(cfg *config.Config) {
cfg.GRPC.TLS.Key = cfg.Commons.GRPCServiceTLS.Key
}
}
if cfg.Tasks.PurgeTrashBin.UserID == "" && cfg.Commons != nil {
cfg.Tasks.PurgeTrashBin.UserID = cfg.Commons.AdminUserID
}
}
func Sanitize(cfg *config.Config) {