diff --git a/main.go b/main.go index 4a56fa9c5f8af6de03601a55e916d27dab1f24e8..5b8431701da45d7feeeb23c6b4f62797f4b14f85 100644 --- a/main.go +++ b/main.go @@ -82,8 +82,8 @@ func triggerPuppet(w http.ResponseWriter, req *http.Request) { cmd := exec.Command("/usr/bin/touch", "/TEST") authToken := strings.Split(req.Header.Get("Authorization"), "Bearer ")[1] statusFile := "/tmp/200.json" - writeFile(fmt.Sprintf("{\n \"status\": \"OK\",\n \"response\": 200\n \"token\": %v}", authToken), "/tmp/200.json") - writeFile(fmt.Sprintf("{\n \"status\": \"KO\",\n \"response\": 503\n \"token\": %v}", authToken), "/tmp/503.json") + writeFile(fmt.Sprintf("{\n \"status\": \"OK\",\n \"response\": 200\n \"token\": %v\n}", authToken), "/tmp/200.json") + writeFile(fmt.Sprintf("{\n \"status\": \"KO\",\n \"response\": 503\n \"token\": %v\n}", authToken), "/tmp/503.json") if authToken != bearerToken { statusFile = "/tmp/503.json" //w.WriteHeader(http.StatusUnauthorized) @@ -138,7 +138,8 @@ Options: fmt.Printf("Fail to read file: %v", err) os.Exit(1) } - bearerToken = fmt.Sprintf("Bearer %v", cfg.Section("acme").Key("bearer_token").String()) + //bearerToken = fmt.Sprintf("Bearer %v", cfg.Section("acme").Key("bearer_token").String()) + bearerToken = cfg.Section("acme").Key("bearer_token").String() webDir = "/var/www/acme_web" jsonConverter = arguments["--json-converter"].(string)