diff --git a/Makefile b/Makefile index e5adf04f..49eb3347 100644 --- a/Makefile +++ b/Makefile @@ -82,9 +82,10 @@ clean: .PHONY: quick quick: LDF += $(shell GOPATH=${GOPATH} build/flags.sh) -quick: +quick: @echo "Run 'make glide' before building" - $(GO) build + $(GO) clean `glide novendor` + $(GO) build `glide novendor` # The `make build` command compiles # the build flags, gets the project diff --git a/web/web.go b/web/web.go index 4767a23e..38230f96 100644 --- a/web/web.go +++ b/web/web.go @@ -19,7 +19,6 @@ import ( "github.com/abcum/fibre/mw" "github.com/abcum/surreal/cnf" "github.com/abcum/surreal/log" - "github.com/dgrijalva/jwt-go" ) // Setup sets up the server for remote connections @@ -81,10 +80,10 @@ func Setup(opts *cnf.Options) (err error) { // Setup special authentication s.Use(mw.Sign(&mw.SignOpts{ - Key: []byte(opts.Auth.Key), - Fnc: func(c *fibre.Context, t *jwt.Token) error { - c.Set("NS", t.Claims["ns"]) - c.Set("DB", t.Claims["db"]) + Key: []byte(opts.Auth.Token), + Fnc: func(c *fibre.Context, h, d map[string]interface{}) error { + c.Set("NS", d["ns"]) + c.Set("DB", d["db"]) return nil }, }).Path("/rpc", "/sql", "/key")) @@ -98,7 +97,13 @@ func Setup(opts *cnf.Options) (err error) { // 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