don't panic
This commit is contained in:
parent
316daa1eda
commit
3952248c6a
|
@ -79,17 +79,10 @@ func (b *BoltDBStorage) GetAllRoutes(ctx context.Context, user string) ([]Route,
|
||||||
}
|
}
|
||||||
|
|
||||||
// PutRoute creates a new route in the database.
|
// PutRoute creates a new route in the database.
|
||||||
func (b *BoltDBStorage) PutRoute(ctx context.Context, domain, kind string) (Route, error) {
|
func (b *BoltDBStorage) PutRoute(ctx context.Context, domain, creator string) (Route, error) {
|
||||||
switch kind {
|
|
||||||
case "tcp", "http":
|
|
||||||
// empty case, do nothing
|
|
||||||
default:
|
|
||||||
return Route{}, ErrInvalidKind
|
|
||||||
}
|
|
||||||
|
|
||||||
r := Route{
|
r := Route{
|
||||||
ID: uuid.New(),
|
ID: uuid.New(),
|
||||||
Creator: ctx.Value("creator").(string),
|
Creator: creator,
|
||||||
Hostname: domain,
|
Hostname: domain,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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"})
|
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 {
|
if err != nil {
|
||||||
ln.Error(err, ln.F{"action": "Route.Put"})
|
ln.Error(err, ln.F{"action": "Route.Put"})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue