Skip to content

Commit

Permalink
fix definition.go
Browse files Browse the repository at this point in the history
  • Loading branch information
akiyatomohiro committed Nov 6, 2024
1 parent 96d0439 commit 9910a50
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 2 additions & 2 deletions api/cmd/policy-generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

func main() {
if err := generator.GeneratePolicies(
"flow",
rbac.ServiceName,
rbac.DefineResources,
"policies",
rbac.PolicyFileDir,
); err != nil {
log.Fatalf("Failed to generate policies: %v", err)
}
Expand Down
5 changes: 2 additions & 3 deletions api/internal/app/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (

"github.com/labstack/echo/v4"
"github.com/reearth/reearth-flow/api/internal/app/config"
"github.com/reearth/reearth-flow/api/internal/rbac"
"github.com/reearth/reearth-flow/api/internal/usecase/gateway"
"github.com/reearth/reearth-flow/api/internal/usecase/repo"
"github.com/reearth/reearthx/account/accountusecase/accountgateway"
Expand All @@ -18,8 +19,6 @@ import (
"golang.org/x/net/http2"
)

const serviceName = "flow"

func Start(debug bool, version string) {
log.Infof("reerath-flow %s", version)

Expand Down Expand Up @@ -49,7 +48,7 @@ func Start(debug bool, version string) {
repos, gateways, acRepos, acGateways := initReposAndGateways(ctx, conf, debug)

// PermissionChecker
permissionChecker := cerbosClient.NewPermissionChecker(serviceName, conf.DashboardHost)
permissionChecker := cerbosClient.NewPermissionChecker(rbac.ServiceName, conf.DashboardHost)

// Start web server
NewServer(ctx, &ServerConfig{
Expand Down
5 changes: 5 additions & 0 deletions api/internal/rbac/definitions.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ import (
"github.com/reearth/reearthx/cerbos/generator"
)

const (
ServiceName = "flow"
PolicyFileDir = "policies"
)

const (
ResourceProject = "project"
ResourceWorkflow = "workflow"
Expand Down

0 comments on commit 9910a50

Please sign in to comment.