mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-01 09:52:23 -06:00
@@ -24,7 +24,6 @@ type Config struct {
|
||||
type Postprocessing struct {
|
||||
Events Events `yaml:"events"`
|
||||
Virusscan bool `yaml:"virusscan" env:"POSTPROCESSING_VIRUSSCAN" desc:"should the system do a virusscan? Needs antivirus service"`
|
||||
FTSIndex bool `yaml:"fulltextsearch" env:"POSTPROCESSING_FTS" desc:"should the system index files for fts? Needs search service"`
|
||||
Delayprocessing time.Duration `yaml:"delayprocessing" env:"POSTPROCESSING_DELAY" desc:"the sytem sleeps for this time while postprocessing"`
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import (
|
||||
"github.com/owncloud/ocis/v2/services/postprocessing/pkg/config"
|
||||
)
|
||||
|
||||
// FullDefaultConfig returns a full sanitized config
|
||||
func FullDefaultConfig() *config.Config {
|
||||
cfg := DefaultConfig()
|
||||
EnsureDefaults(cfg)
|
||||
@@ -11,6 +12,7 @@ func FullDefaultConfig() *config.Config {
|
||||
return cfg
|
||||
}
|
||||
|
||||
// DefaultConfig is the default configuration
|
||||
func DefaultConfig() *config.Config {
|
||||
return &config.Config{
|
||||
Service: config.Service{
|
||||
@@ -21,12 +23,11 @@ func DefaultConfig() *config.Config {
|
||||
Endpoint: "127.0.0.1:9233",
|
||||
Cluster: "ocis-cluster",
|
||||
},
|
||||
// Virusscan: true,
|
||||
// FTSIndex: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
// EnsureDefaults ensures defaults on a config
|
||||
func EnsureDefaults(cfg *config.Config) {
|
||||
// provide with defaults for shared logging, since we need a valid destination address for BindEnv.
|
||||
if cfg.Log == nil && cfg.Commons != nil && cfg.Commons.Log != nil {
|
||||
@@ -41,6 +42,6 @@ func EnsureDefaults(cfg *config.Config) {
|
||||
}
|
||||
}
|
||||
|
||||
// Sanitize does nothing atm
|
||||
func Sanitize(cfg *config.Config) {
|
||||
// nothing to sanitize here atm
|
||||
}
|
||||
|
||||
@@ -17,13 +17,13 @@ type Postprocessing struct {
|
||||
m map[events.Postprocessingstep]interface{}
|
||||
filename string
|
||||
filesize uint64
|
||||
resourceId *provider.ResourceId
|
||||
resourceID *provider.ResourceId
|
||||
c config.Postprocessing
|
||||
steps []events.Postprocessingstep
|
||||
}
|
||||
|
||||
// New returns a new postprocessing instance
|
||||
func New(uploadID string, uploadURL string, user *user.User, filename string, filesize uint64, resourceId *provider.ResourceId, c config.Postprocessing) *Postprocessing {
|
||||
func New(uploadID string, uploadURL string, user *user.User, filename string, filesize uint64, resourceID *provider.ResourceId, c config.Postprocessing) *Postprocessing {
|
||||
return &Postprocessing{
|
||||
id: uploadID,
|
||||
url: uploadURL,
|
||||
@@ -32,7 +32,7 @@ func New(uploadID string, uploadURL string, user *user.User, filename string, fi
|
||||
c: c,
|
||||
filename: filename,
|
||||
filesize: filesize,
|
||||
resourceId: resourceId,
|
||||
resourceID: resourceID,
|
||||
steps: getSteps(c),
|
||||
}
|
||||
}
|
||||
@@ -85,7 +85,7 @@ func (pp *Postprocessing) nextStep(next events.Postprocessingstep) events.StartP
|
||||
ExecutingUser: pp.u,
|
||||
Filename: pp.filename,
|
||||
Filesize: pp.filesize,
|
||||
ResourceID: pp.resourceId,
|
||||
ResourceID: pp.resourceID,
|
||||
StepToStart: next,
|
||||
}
|
||||
}
|
||||
@@ -114,9 +114,5 @@ func getSteps(c config.Postprocessing) []events.Postprocessingstep {
|
||||
steps = append(steps, events.PPStepAntivirus)
|
||||
}
|
||||
|
||||
if c.FTSIndex {
|
||||
steps = append(steps, events.PPStepFTS)
|
||||
}
|
||||
|
||||
return steps
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user