Skip to content

Commit

Permalink
Use oci package in repl
Browse files Browse the repository at this point in the history
Signed-off-by: carabasdaniel <[email protected]>
  • Loading branch information
carabasdaniel committed Mar 10, 2023
1 parent 8997121 commit 65b512f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions pkg/app/repl.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,24 @@ import (
"time"

"github.com/aserto-dev/runtime"
"github.com/opcr-io/policy/pkg/oci"
"github.com/opcr-io/policy/pkg/parser"
"github.com/open-policy-agent/opa/repl"
"github.com/pkg/errors"
"oras.land/oras-go/pkg/content"
)

func (c *PolicyApp) Repl(ref string, maxErrors int) error {
defer c.Cancel()

ociStore, err := content.NewOCI(c.Configuration.PoliciesRoot())
ociClient, err := oci.NewOCI(c.Context, c.Logger, c.getHosts, c.Configuration.PoliciesRoot())
if err != nil {
return err
}
err = ociStore.LoadIndex()

existingRefs, err := ociClient.ListReferences()
if err != nil {
return err
}

existingRefs := ociStore.ListReferences()
existingRefParsed, err := parser.CalculatePolicyRef(ref, c.Configuration.DefaultDomain)
if err != nil {
return err
Expand All @@ -38,12 +37,10 @@ func (c *PolicyApp) Repl(ref string, maxErrors int) error {
return err
}

err = ociStore.LoadIndex()
existingRefs, err := ociClient.ListReferences()
if err != nil {
return err
}

existingRefs = ociStore.ListReferences()
existingRefParsed, err := parser.CalculatePolicyRef(ref, c.Configuration.DefaultDomain)
if err != nil {
return err
Expand Down

0 comments on commit 65b512f

Please sign in to comment.