Files
QSfera/services/policies/pkg/engine/opa/opa.go
T
c09f82405f enhancement: add mimetype to file extension rego function (#6133)
* enhancement: add mimetype to file extension rego function

add rego function to detect the resource extension by mimetype, at the same time this pr introduces a custom ocis namespace for the rego functions.

* enhancement: add custom logPrinter to opa policies service

* fix: imports and test

TypeByExtension which is used to resolve extension by mimetype relies on MIME-info database which differs at my local env (macos <-> drone). This is fixed by using one of the builtinTypes for testing

---------

Signed-off-by: Christian Richter <crichter@owncloud.com>
Co-authored-by: Christian Richter <crichter@owncloud.com>
2023-07-10 16:28:23 +02:00

17 lines
272 B
Go

package opa
import (
"github.com/open-policy-agent/opa/topdown/print"
"github.com/owncloud/ocis/v2/ocis-pkg/log"
)
type logPrinter struct {
logger log.Logger
}
func (lp logPrinter) Print(_ print.Context, msg string) error {
lp.logger.Info().Msg(msg)
return nil
}