From 8478fef9bcdbacfb2700dc2625b11658670b13c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BCl=20P=C3=A9rez?= Date: Tue, 28 Jun 2016 11:12:48 +0000 Subject: [PATCH] Fix getting JWT secret from NATS --- setup.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/setup.go b/setup.go index 0a3fbd9..f43dac2 100644 --- a/setup.go +++ b/setup.go @@ -27,10 +27,14 @@ func setup() { return } - // Set the JWT Secret secret = os.Getenv("JWT_SECRET") if secret == "" { - panic("No JWT secret was set!") + token, err := n.Request("config.get.jwt_token", []byte(""), 1*time.Second) + if err != nil { + panic("Can't get jwt_config config") + } + + secret = string(token.Data) } cfg := monitorConfig{}