diff --git a/changelog/unreleased/postprocessing-config.md b/changelog/unreleased/postprocessing-config.md index d45d521c4..3ff0f17bc 100644 --- a/changelog/unreleased/postprocessing-config.md +++ b/changelog/unreleased/postprocessing-config.md @@ -1,5 +1,5 @@ Enhancement: Better config for postprocessing service -We want postprocessing service to be individually configurable. We achieve this by allowing to define a list of postprocessing steps with the `POSTPROCESSING_STEPS` envvar +The postporcessing service is now individually configurable. This is achieved by allowing a list of postprocessing steps that are processed in order of their appearance in the `POSTPROCESSING_STEPS` envvar. https://github.com/owncloud/ocis/pull/5457 diff --git a/services/postprocessing/README.md b/services/postprocessing/README.md index 88d2790dd..e3765a200 100644 --- a/services/postprocessing/README.md +++ b/services/postprocessing/README.md @@ -20,18 +20,18 @@ When postprocessing has been enabled, configuring any postprocessing step will r ## Postprocessing Steps -`ocis` allows setting the order and amount of postprocessing steps via the `POSTPROCESSING_STEPS` envvar. It expects a comma seperated list of steps that should be executed. Known to the system are `virusscan` and `delay`. It is allowed to set custom steps. +The postporcessing service is individually configurable. This is achieved by allowing a list of postprocessing steps that are processed in order of their appearance in the `POSTPROCESSING_STEPS` envvar. This envvar expects a comma separated list of steps that will be executed. Currently known steps to the system are `virusscan` and `delay`. Custom steps can be added but need an existing target for processing. ### Virus Scanning -To enable virus scanning as a postprocessing step after uploading a file, the environment variable `POSTPROCESSING_STEPS` needs to contain the word `virusscan`. As a result, each uploaded file gets virus scanned as part of the postprocessing steps. Note that the `antivirus` service is required to be enabled and configured for this to work. +To enable virus scanning as a postprocessing step after uploading a file, the environment variable `POSTPROCESSING_STEPS` needs to contain the word `virusscan` at one location in the list of steps. As a result, each uploaded file gets virus scanned as part of the postprocessing steps. Note that the `antivirus` service is required to be enabled and configured for this to work. ### Delay Though this is for development purposes only and NOT RECOMMENDED on production systems, setting the environment variable `POSTPROCESSING_DELAY` to a duration not equal to zero will add a delay step with the configured amount of time. ocis will continue postprocessing the file after the configured delay. Use the enviroment variable `POSTPROCESSING_STEPS` and the keyword `delay` if you have multiple postprocessing steps and want to define their order. If `POSTPROCESSING_DELAY` is set but `delay` is not contained in `POSTPROCESSING_STEPS` it will be added as last postprocessing step. ### Custom Postprocessing Steps -Using the envvar `POSTPROCESSING_STEPS` custom postprocessing steps can be added. Any word can be used as step name but be careful not to clash with exising steps `virusscan` and `delay`. +By using the envvar `POSTPROCESSING_STEPS`, custom postprocessing steps can be added. Any word can be used as step name but be careful not to conflict with exising keywords like `virusscan` and `delay`. In addition, if a keyword is misspelled or the corresponding service does either not exist or does not follow the necessary event communication, the postprocessing service will wait forever getting the required response to proceed and does not continue any other processing. #### Prerequisites For using custom postprocessing steps you need a custom service listening to the configured event system (see `General Prerequisites`) @@ -39,6 +39,6 @@ For using custom postprocessing steps you need a custom service listening to the #### Workflow When setting a custom postprocessing step (eg. `"customstep"`) the postprocessing service will eventually sent an event during postprocessing. The event will be of type `StartPostprocessingStep` with its field `StepToStart` set to `"customstep"`. When the custom service receives this event it can savely execute its actions, postprocessing service will wait until it has finished its work. The event contains further information (filename, executing user, size, ...) and also required tokens and urls to download the file in case byte inspection is necessary. -Once the custom service has finished its work it should sent an event of type `PostprocessingFinished` via the configured events system. This event needs to contain a `FinishedStep` field set to `"customstep"`. It also must contain the outcome of the step, which can be one of "delete" (abort postprocessing, delete the file), "abort" (abort postprocessing, keep the file) and "continue" (continue postprocessing, this is the success case). +Once the custom service has finished its work, it should sent an event of type `PostprocessingFinished` via the configured events system. This event needs to contain a `FinishedStep` field set to `"customstep"`. It also must contain the outcome of the step, which can be one of "delete" (abort postprocessing, delete the file), "abort" (abort postprocessing, keep the file) and "continue" (continue postprocessing, this is the success case). See https://github.com/cs3org/reva/blob/edge/pkg/events/postprocessing.go for up-to-date information of reserved step names and event definitons. diff --git a/services/postprocessing/pkg/config/config.go b/services/postprocessing/pkg/config/config.go index 9f688b290..d46398d97 100644 --- a/services/postprocessing/pkg/config/config.go +++ b/services/postprocessing/pkg/config/config.go @@ -23,7 +23,7 @@ type Config struct { // Postprocessing definces the config options for the postprocessing service. type Postprocessing struct { Events Events `yaml:"events"` - Steps []string `yaml:"steps" env:"POSTPROCESSING_STEPS" desc:"A comma seperated list of postprocessing steps. Known to the system are virusscan and delay. Custom steps are allowed. See README.md for instructions."` + Steps []string `yaml:"steps" env:"POSTPROCESSING_STEPS" desc:"A comma separated list of postprocessing steps, processed in order of their appearance. Currently supported values by the system are: 'virusscan' and 'delay'. Custom steps are allowed. See the documentation for instructions."` Virusscan bool `yaml:"virusscan" env:"POSTPROCESSING_VIRUSSCAN" desc:"After uploading a file but before making it available for download, virus scanning the file can be enabled. Needs as prerequisite the antivirus service to be enabled and configured."` Delayprocessing time.Duration `yaml:"delayprocessing" env:"POSTPROCESSING_DELAY" desc:"After uploading a file but before making it available for download, a delay step can be added. Intended for developing purposes only. The duration can be set as number followed by a unit identifier like s, m or h."` }