mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-12-23 08:56:29 +00:00
Merge pull request #1851 from bradrydzewski/feature/mq
ability to enable broker debugging
This commit is contained in:
commit
5bac61dc4b
2 changed files with 17 additions and 1 deletions
|
@ -26,6 +26,11 @@ var serverCmd = cli.Command{
|
|||
Name: "debug",
|
||||
Usage: "start the server in debug mode",
|
||||
},
|
||||
cli.BoolFlag{
|
||||
EnvVar: "DRONE_BROKER_DEBUG",
|
||||
Name: "broker-debug",
|
||||
Usage: "start the broker in debug mode",
|
||||
},
|
||||
cli.StringFlag{
|
||||
EnvVar: "DRONE_SERVER_ADDR",
|
||||
Name: "server-addr",
|
||||
|
|
|
@ -1,16 +1,19 @@
|
|||
package middleware
|
||||
|
||||
import (
|
||||
"os"
|
||||
"sync"
|
||||
|
||||
handlers "github.com/drone/drone/server"
|
||||
|
||||
"github.com/codegangsta/cli"
|
||||
"github.com/drone/mq/logger"
|
||||
"github.com/drone/mq/server"
|
||||
"github.com/drone/mq/stomp"
|
||||
|
||||
"github.com/Sirupsen/logrus"
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/tidwall/redlog"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -23,7 +26,15 @@ const (
|
|||
func Broker(cli *cli.Context) gin.HandlerFunc {
|
||||
secret := cli.String("agent-secret")
|
||||
if secret == "" {
|
||||
logrus.Fatalf("failed to generate token from DRONE_SECRET")
|
||||
logrus.Fatalf("fatal error. please provide the DRONE_SECRET")
|
||||
}
|
||||
|
||||
// setup broker logging.
|
||||
log := redlog.New(os.Stderr)
|
||||
log.SetLevel(0)
|
||||
logger.SetLogger(log)
|
||||
if cli.Bool("broker-debug") {
|
||||
log.SetLevel(1)
|
||||
}
|
||||
|
||||
broker := server.NewServer(
|
||||
|
|
Loading…
Reference in a new issue