From 67d762e731e384147caf728ecc9230a1d47db902 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 14 May 2020 09:29:05 -0400 Subject: [PATCH] api: add debug option to server binary --- api/server.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/server.go b/api/server.go index f8b263f..6f9685c 100644 --- a/api/server.go +++ b/api/server.go @@ -27,6 +27,7 @@ func main() { var ( addr string = defaultAddr config ini.File + debug bool err error ) opts, _, err := getopt.Getopts(os.Args, "b:d") @@ -37,6 +38,8 @@ func main() { switch opt.Option { case 'b': addr = opt.Value + case 'd': + debug = true } } @@ -71,7 +74,9 @@ func main() { Resolvers: &graph.Resolver{DB: db}, })) - router.Handle("/", playground.Handler("GraphQL playground", "/query")) + if debug { + router.Handle("/", playground.Handler("GraphQL playground", "/query")) + } router.Handle("/query", srv) log.Printf("running on %s", addr) -- 2.38.4