From 9342891f14f2623f5b186a8bc36fb3403904dc5b Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Fri, 28 Apr 2017 22:45:43 -0700 Subject: [PATCH] generate host if none exists --- server/route.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server/route.go b/server/route.go index 5e180e1..499c752 100644 --- a/server/route.go +++ b/server/route.go @@ -1,6 +1,7 @@ package server import ( + "git.xeserv.us/xena/route/lib/elfs" proto "git.xeserv.us/xena/route/proto" "github.com/Xe/ln" "golang.org/x/net/context" @@ -69,6 +70,10 @@ 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"}) } + if rt.Host == "" { + rt.Host = elfs.MakeName() + r.cfg.DomainSuffix + } + drt, err := r.db.PutRoute(ctx, rt.Host, clitok.Owner) if err != nil { ln.Error(err, ln.F{"action": "Route.Put"})