diff --git a/app.go b/app.go index ad0396e11..758535544 100644 --- a/app.go +++ b/app.go @@ -1,17 +1,11 @@ package buffalo import ( - "fmt" "net/http" - "os" - "os/signal" - "strings" "sync" - "syscall" gcontext "github.com/gorilla/context" "github.com/gorilla/mux" - "github.com/markbates/refresh/refresh/web" "github.com/pkg/errors" ) @@ -30,62 +24,6 @@ type App struct { children []*App } -// Start the application at the specified address/port and listen for OS -// interrupt and kill signals and will attempt to stop the application -// gracefully. This will also start the Worker process, unless WorkerOff is enabled. -func (a *App) Start(addr string) error { - if !strings.Contains(addr, ":") { - addr = fmt.Sprintf(":%s", addr) - } - fmt.Printf("Starting application at %s\n", addr) - server := http.Server{ - Addr: addr, - Handler: a, - } - - go func() { - // gracefully shut down the application when the context is cancelled - <-a.Context.Done() - fmt.Println("Shutting down application") - err := server.Shutdown(a.Context) - if err != nil { - a.Logger.Error(errors.WithStack(err)) - } - if !a.WorkerOff { - // stop the workers - err = a.Worker.Stop() - if err != nil { - a.Logger.Error(errors.WithStack(err)) - } - } - }() - - // if configured to do so, start the workers - if !a.WorkerOff { - go func() { - err := a.Worker.Start(a.Context) - if err != nil { - a.Stop(errors.WithStack(err)) - } - }() - } - - // listen for system signals, like CTRL-C - go func() { - signalChan := make(chan os.Signal, 1) - signal.Notify(signalChan, os.Interrupt, syscall.SIGTERM) - <-signalChan - a.Stop(nil) - }() - - // start the web server - err := server.ListenAndServe() - if err != nil { - return a.Stop(errors.WithStack(err)) - } - return nil -} - // Stop the application and attempt to gracefully shutdown func (a *App) Stop(err error) error { a.cancel() @@ -106,9 +44,9 @@ func (a *App) ServeHTTP(w http.ResponseWriter, r *http.Request) { } var h http.Handler h = a.router - if a.Env == "development" { - h = web.ErrorChecker(h) - } + // if a.Env == "development" { + // h = web.ErrorChecker(h) + // } h.ServeHTTP(ws, r) } diff --git a/buffalo/cmd/dev.go b/buffalo/cmd/dev.go index b32137232..82a88c2d9 100644 --- a/buffalo/cmd/dev.go +++ b/buffalo/cmd/dev.go @@ -1,3 +1,5 @@ +// +build !appengine + package cmd import ( diff --git a/generators/newapp/new.go b/generators/newapp/new.go index 718837f43..cfbf98f9e 100644 --- a/generators/newapp/new.go +++ b/generators/newapp/new.go @@ -1,3 +1,5 @@ +// +build !appengine + package newapp import ( diff --git a/generators/refresh/refresh.go b/generators/refresh/refresh.go index 87fdf7c07..4ec1e8f7f 100644 --- a/generators/refresh/refresh.go +++ b/generators/refresh/refresh.go @@ -1,3 +1,5 @@ +// +build !appengine + package refresh import ( diff --git a/grifts/shoulders.go b/grifts/shoulders.go index 1ba30da95..86a4858bd 100755 --- a/grifts/shoulders.go +++ b/grifts/shoulders.go @@ -1,3 +1,5 @@ +// +build !appengine + package grifts import (