Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Commit

Permalink
resource identifier integration (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
amaskalenka authored Jun 25, 2018
1 parent 254926f commit 7f38249
Show file tree
Hide file tree
Showing 10 changed files with 1,337 additions and 590 deletions.
8 changes: 5 additions & 3 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
name = "google.golang.org/grpc"
version = "1.11.2"

[[constraint]]
name = "github.com/infobloxopen/atlas-app-toolkit"
branch = "master"

[prune]
go-tests = true
unused-packages = true
5 changes: 2 additions & 3 deletions cmd/server/errormapping.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ var ErrorMappings = []errors.MapFunc{

errors.NewMapping(
errors.CondHasPrefix("pq:"),
errors.MapFunc(func (ctx context.Context, err error) (error, bool) {
errors.MapFunc(func(ctx context.Context, err error) (error, bool) {
if res := regexp.MustCompile(`column "(\w+)" does not exist`).FindStringSubmatch(err.Error()); len(res) > 0 {
return errors.NewContainer(codes.InvalidArgument, "Invalid collection operator parameter %q.", res[1]), true
}
Expand All @@ -32,9 +32,8 @@ var ErrorMappings = []errors.MapFunc{
errors.NewMapping(
// Here CondAnd without condition functions serves as 'default'.
errors.CondAnd(),
errors.MapFunc(func (ctx context.Context, err error) (error, bool) {
errors.MapFunc(func(ctx context.Context, err error) (error, bool) {
return errors.NewContainer(codes.Internal, "Error: %s", err), true
}),
),

}
2 changes: 0 additions & 2 deletions cmd/server/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
toolkit_auth "github.com/infobloxopen/atlas-app-toolkit/auth"
"github.com/infobloxopen/atlas-app-toolkit/gateway"
"github.com/infobloxopen/atlas-app-toolkit/requestid"
"github.com/infobloxopen/atlas-app-toolkit/errors"
"github.com/infobloxopen/atlas-contacts-app/pkg/pb"
"github.com/infobloxopen/atlas-contacts-app/pkg/svc"
"github.com/jinzhu/gorm"
Expand All @@ -21,7 +20,6 @@ func NewGRPCServer(logger *logrus.Logger, db *gorm.DB) (*grpc.Server, error) {
// validation interceptor
grpc_validator.UnaryServerInterceptor(),
grpc_logrus.UnaryServerInterceptor(logrus.NewEntry(logger)),
errors.UnaryServerInterceptor(ErrorMappings...),
gateway.UnaryServerInterceptor(),
requestid.UnaryServerInterceptor(),
}
Expand Down
3 changes: 3 additions & 0 deletions cmd/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import (
"time"

"database/sql"

"github.com/infobloxopen/atlas-app-toolkit/gateway"
"github.com/infobloxopen/atlas-app-toolkit/gorm/resource"
"github.com/infobloxopen/atlas-app-toolkit/health"
"github.com/infobloxopen/atlas-app-toolkit/server"
"github.com/infobloxopen/atlas-contacts-app/cmd"
Expand Down Expand Up @@ -60,6 +62,7 @@ func init() {
flag.StringVar(&AuthzAddr, "authz", "", "address of the authorization service")
flag.StringVar(&LogLevel, "log", "info", "log level")
flag.Parse()
resource.RegisterApplication("atlas-contacts-app")
}

func NewLogger() *logrus.Logger {
Expand Down
Loading

0 comments on commit 7f38249

Please sign in to comment.