generate host if none exists

This commit is contained in:
Cadey Ratio 2017-04-28 22:45:43 -07:00
parent d7461cfbf5
commit 9342891f14
1 changed files with 5 additions and 0 deletions

View File

@ -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"})