From 3952248c6a4260aeecba25481a8ce7c6869eb3ef Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Fri, 28 Apr 2017 22:39:18 -0700 Subject: [PATCH] don't panic --- database/boltdb.go | 11 ++--------- server/route.go | 2 +- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/database/boltdb.go b/database/boltdb.go index 435aa1f..b493210 100644 --- a/database/boltdb.go +++ b/database/boltdb.go @@ -79,17 +79,10 @@ func (b *BoltDBStorage) GetAllRoutes(ctx context.Context, user string) ([]Route, } // PutRoute creates a new route in the database. -func (b *BoltDBStorage) PutRoute(ctx context.Context, domain, kind string) (Route, error) { - switch kind { - case "tcp", "http": - // empty case, do nothing - default: - return Route{}, ErrInvalidKind - } - +func (b *BoltDBStorage) PutRoute(ctx context.Context, domain, creator string) (Route, error) { r := Route{ ID: uuid.New(), - Creator: ctx.Value("creator").(string), + Creator: creator, Hostname: domain, } diff --git a/server/route.go b/server/route.go index 2b5a75e..5e180e1 100644 --- a/server/route.go +++ b/server/route.go @@ -69,7 +69,7 @@ func (r *Route) Put(ctx context.Context, rt *proto.Route) (*proto.IDResponse, er return nil, handleError(ctx, clitok, err, ln.F{"action": "Route.Put_getAuth"}) } - drt, err := r.db.PutRoute(ctx, rt.Host, "http") + drt, err := r.db.PutRoute(ctx, rt.Host, clitok.Owner) if err != nil { ln.Error(err, ln.F{"action": "Route.Put"})