From e647b257e1865034fc56742b314850421597118a Mon Sep 17 00:00:00 2001 From: stefink Date: Thu, 14 Jul 2022 17:33:50 +0530 Subject: [PATCH] changed local to global --- src/integrations/http_server.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/integrations/http_server.go b/src/integrations/http_server.go index 1937756..2f66116 100644 --- a/src/integrations/http_server.go +++ b/src/integrations/http_server.go @@ -21,21 +21,19 @@ func loghandler(w http.ResponseWriter, r *http.Request) { fmt.Fprintf(w, "err : %v", err) } w.Header().Set("Content-Type", "application/json") - config, err := ReadLogConfig("src/conf/datasage.yaml") - if err != nil { - fmt.Fprintf(w, `{status: "not ok", "error": %v}`, err) - return - } + fmt.Fprintf(w, `{status : "ok"}`) go func(http.ResponseWriter) { config.StreamLogToAll(string(body)) if err != nil { fmt.Fprintf(w, `{status: "not ok", "error": %v}`, err) return } - fmt.Fprintf(w, `{status : "ok"}`) }(w) } + +var config, _ = ReadLogConfig("src/conf/datasage.yaml") + func RunServer() { http.HandleFunc("/log", loghandler)