Skip to content

Commit

Permalink
fix service merge problem for policy (koderover#1881)
Browse files Browse the repository at this point in the history
Signed-off-by: Min Min <[email protected]>

Signed-off-by: Min Min <[email protected]>
Co-authored-by: Min Min <[email protected]>
  • Loading branch information
jamsman94 and Min Min authored Aug 16, 2022
1 parent c8e81f9 commit 13c2a9c
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ func MongoDatabase() string {
return viper.GetString(setting.ENVAslanDBName)
}

func PolicyDatabase() string {
return MongoDatabase() + "_policy"
}

func MysqlUser() string {
return viper.GetString(setting.ENVMysqlUser)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/microservice/policy/core/repository/mongodb/policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type PolicyColl struct {
func NewPolicyColl() *PolicyColl {
name := models.Policy{}.TableName()
return &PolicyColl{
Collection: mongotool.Database(config.MongoDatabase()).Collection(name),
Collection: mongotool.Database(config.PolicyDatabase()).Collection(name),
coll: name,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type PolicyBindingColl struct {
func NewPolicyBindingColl() *PolicyBindingColl {
name := models.PolicyBinding{}.TableName()
return &PolicyBindingColl{
Collection: mongotool.Database(config.MongoDatabase()).Collection(name),
Collection: mongotool.Database(config.PolicyDatabase()).Collection(name),
coll: name,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ type PolicyMetaColl struct {
func NewPolicyMetaColl() *PolicyMetaColl {
name := models.PolicyMeta{}.TableName()
return &PolicyMetaColl{
Collection: mongotool.Database(config.MongoDatabase()).Collection(name),
Collection: mongotool.Database(config.PolicyDatabase()).Collection(name),
coll: name,
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/microservice/policy/core/repository/mongodb/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type RoleColl struct {
func NewRoleColl() *RoleColl {
name := models.Role{}.TableName()
return &RoleColl{
Collection: mongotool.Database(config.MongoDatabase()).Collection(name),
Collection: mongotool.Database(config.PolicyDatabase()).Collection(name),
coll: name,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type RoleBindingColl struct {
func NewRoleBindingColl() *RoleBindingColl {
name := models.RoleBinding{}.TableName()
return &RoleBindingColl{
Collection: mongotool.Database(config.MongoDatabase()).Collection(name),
Collection: mongotool.Database(config.PolicyDatabase()).Collection(name),
coll: name,
}
}
Expand Down

0 comments on commit 13c2a9c

Please sign in to comment.