Clean before build in development

This commit is contained in:
Tobie Morgan Hitchcock 2016-04-13 15:40:19 +01:00
parent 6e98759d08
commit 748cc2fe14
2 changed files with 14 additions and 8 deletions

View file

@ -84,7 +84,8 @@ clean:
quick: LDF += $(shell GOPATH=${GOPATH} build/flags.sh) quick: LDF += $(shell GOPATH=${GOPATH} build/flags.sh)
quick: quick:
@echo "Run 'make glide' before building" @echo "Run 'make glide' before building"
$(GO) build $(GO) clean `glide novendor`
$(GO) build `glide novendor`
# The `make build` command compiles # The `make build` command compiles
# the build flags, gets the project # the build flags, gets the project

View file

@ -19,7 +19,6 @@ import (
"github.com/abcum/fibre/mw" "github.com/abcum/fibre/mw"
"github.com/abcum/surreal/cnf" "github.com/abcum/surreal/cnf"
"github.com/abcum/surreal/log" "github.com/abcum/surreal/log"
"github.com/dgrijalva/jwt-go"
) )
// Setup sets up the server for remote connections // Setup sets up the server for remote connections
@ -81,10 +80,10 @@ func Setup(opts *cnf.Options) (err error) {
// Setup special authentication // Setup special authentication
s.Use(mw.Sign(&mw.SignOpts{ s.Use(mw.Sign(&mw.SignOpts{
Key: []byte(opts.Auth.Key), Key: []byte(opts.Auth.Token),
Fnc: func(c *fibre.Context, t *jwt.Token) error { Fnc: func(c *fibre.Context, h, d map[string]interface{}) error {
c.Set("NS", t.Claims["ns"]) c.Set("NS", d["ns"])
c.Set("DB", t.Claims["db"]) c.Set("DB", d["db"])
return nil return nil
}, },
}).Path("/rpc", "/sql", "/key")) }).Path("/rpc", "/sql", "/key"))
@ -98,7 +97,13 @@ func Setup(opts *cnf.Options) (err error) {
// Run the server // Run the server
s.Run(opts.Conn.Http) if len(opts.Cert.Crt.File) == 0 || len(opts.Cert.Key.File) == 0 {
s.Run(opts.Conn.Http)
}
if len(opts.Cert.Crt.File) != 0 && len(opts.Cert.Key.File) != 0 {
s.Run(opts.Conn.Http, opts.Cert.Crt.File, opts.Cert.Key.File)
}
return nil return nil