mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-01-31 09:21:18 -05:00
* add policies service add policies proxy middleware add policies event service add policies grpc service prepare ci and git environments (ci, make, readme, doc) * add webfinger to the drone conf * fix docs remove not used virus scan postprocessing step * relocate example rego file implicitly enable and disable proxy and postprocessing policy checking by setting the query. update configuration descriptions * move policies update readme * use converter func to convert pp environment to actual environment expose and test custom rego functions add engine unit tests add opa unit tests update policies readme Co-authored-by: Martin <github@diemattels.at> * relocate sample policies to the deployments folder change and document policies service port * update index.md and small fix * add health command add version command add debug server --------- Co-authored-by: Martin <github@diemattels.at>
55 lines
1.2 KiB
Go
55 lines
1.2 KiB
Go
package command
|
|
|
|
import (
|
|
"context"
|
|
"os"
|
|
|
|
"github.com/owncloud/ocis/v2/ocis-pkg/clihelper"
|
|
ociscfg "github.com/owncloud/ocis/v2/ocis-pkg/config"
|
|
"github.com/owncloud/ocis/v2/services/policies/pkg/config"
|
|
"github.com/thejerf/suture/v4"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
// GetCommands provides all commands for this service
|
|
func GetCommands(cfg *config.Config) cli.Commands {
|
|
return []*cli.Command{
|
|
Server(cfg),
|
|
Health(cfg),
|
|
Version(cfg),
|
|
}
|
|
}
|
|
|
|
// Execute is the entry point for the policies command.
|
|
func Execute(cfg *config.Config) error {
|
|
app := clihelper.DefaultApp(&cli.App{
|
|
Name: "policies",
|
|
Usage: "Serve ownCloud policies for oCIS",
|
|
Commands: GetCommands(cfg),
|
|
})
|
|
|
|
return app.Run(os.Args)
|
|
}
|
|
|
|
// SutureService allows for the web command to be embedded and supervised by a suture supervisor tree.
|
|
type SutureService struct {
|
|
cfg *config.Config
|
|
}
|
|
|
|
// NewSutureService creates a new web.SutureService
|
|
func NewSutureService(cfg *ociscfg.Config) suture.Service {
|
|
cfg.Policies.Commons = cfg.Commons
|
|
return SutureService{
|
|
cfg: cfg.Policies,
|
|
}
|
|
}
|
|
|
|
func (s SutureService) Serve(ctx context.Context) error {
|
|
s.cfg.Context = ctx
|
|
if err := Execute(s.cfg); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|