mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-11-27 04:11:03 +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",
|
Name: "debug",
|
||||||
Usage: "start the server in debug mode",
|
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{
|
cli.StringFlag{
|
||||||
EnvVar: "DRONE_SERVER_ADDR",
|
EnvVar: "DRONE_SERVER_ADDR",
|
||||||
Name: "server-addr",
|
Name: "server-addr",
|
||||||
|
|
|
@ -1,16 +1,19 @@
|
||||||
package middleware
|
package middleware
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
handlers "github.com/drone/drone/server"
|
handlers "github.com/drone/drone/server"
|
||||||
|
|
||||||
"github.com/codegangsta/cli"
|
"github.com/codegangsta/cli"
|
||||||
|
"github.com/drone/mq/logger"
|
||||||
"github.com/drone/mq/server"
|
"github.com/drone/mq/server"
|
||||||
"github.com/drone/mq/stomp"
|
"github.com/drone/mq/stomp"
|
||||||
|
|
||||||
"github.com/Sirupsen/logrus"
|
"github.com/Sirupsen/logrus"
|
||||||
"github.com/gin-gonic/gin"
|
"github.com/gin-gonic/gin"
|
||||||
|
"github.com/tidwall/redlog"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -23,7 +26,15 @@ const (
|
||||||
func Broker(cli *cli.Context) gin.HandlerFunc {
|
func Broker(cli *cli.Context) gin.HandlerFunc {
|
||||||
secret := cli.String("agent-secret")
|
secret := cli.String("agent-secret")
|
||||||
if 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(
|
broker := server.NewServer(
|
||||||
|
|
Loading…
Reference in a new issue