updated serve command error reporting
This commit is contained in:
parent
eaf121ead7
commit
2862119c1f
10
cmd/serve.go
10
cmd/serve.go
|
@ -2,7 +2,6 @@ package cmd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"log"
|
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/pocketbase/pocketbase/apis"
|
"github.com/pocketbase/pocketbase/apis"
|
||||||
|
@ -21,7 +20,8 @@ func NewServeCommand(app core.App, showStartBanner bool) *cobra.Command {
|
||||||
Use: "serve [domain(s)]",
|
Use: "serve [domain(s)]",
|
||||||
Args: cobra.ArbitraryArgs,
|
Args: cobra.ArbitraryArgs,
|
||||||
Short: "Starts the web server (default to 127.0.0.1:8090 if no domain is specified)",
|
Short: "Starts the web server (default to 127.0.0.1:8090 if no domain is specified)",
|
||||||
Run: func(command *cobra.Command, args []string) {
|
SilenceUsage: true,
|
||||||
|
RunE: func(command *cobra.Command, args []string) error {
|
||||||
// set default listener addresses if at least one domain is specified
|
// set default listener addresses if at least one domain is specified
|
||||||
if len(args) > 0 {
|
if len(args) > 0 {
|
||||||
if httpAddr == "" {
|
if httpAddr == "" {
|
||||||
|
@ -44,9 +44,11 @@ func NewServeCommand(app core.App, showStartBanner bool) *cobra.Command {
|
||||||
CertificateDomains: args,
|
CertificateDomains: args,
|
||||||
})
|
})
|
||||||
|
|
||||||
if !errors.Is(err, http.ErrServerClosed) {
|
if errors.Is(err, http.ErrServerClosed) {
|
||||||
log.Fatalln(err)
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return err
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue