Skip to content
Snippets Groups Projects
Commit d9e77000 authored by ale's avatar ale
Browse files

build nicer api urls

parent b0da384e
No related branches found
No related tags found
No related merge requests found
...@@ -73,7 +73,7 @@ func main() { ...@@ -73,7 +73,7 @@ func main() {
} }
tlsConf := audit.TLSClientAuthConfigWithCerts(*sslCa, *sslCert, *sslKey) tlsConf := audit.TLSClientAuthConfigWithCerts(*sslCa, *sslCert, *sslKey)
results := runQuery(*serverUrl+"/api/1/query", tlsConf, query) results := runQuery(strings.TrimRight(*serverUrl, "/")+"/api/1/query", tlsConf, query)
for _, msg := range results { for _, msg := range results {
json.NewEncoder(os.Stdout).Encode(msg) json.NewEncoder(os.Stdout).Encode(msg)
os.Stdout.Write([]byte{'\n'}) os.Stdout.Write([]byte{'\n'})
......
...@@ -57,10 +57,13 @@ func newLocalServer(spoolPath string, serverUrl string, tlsConf *tls.Config) *lo ...@@ -57,10 +57,13 @@ func newLocalServer(spoolPath string, serverUrl string, tlsConf *tls.Config) *lo
Transport: timeoutTransport, Transport: timeoutTransport,
} }
// We're only talking to a single API endpoint.
url := strings.TrimRight(serverUrl, "/") + "/api/1/write"
l := &localServer{ l := &localServer{
spool: spool, spool: spool,
http: httpClient, http: httpClient,
url: serverUrl, url: url,
} }
go l.backgroundFlusher() go l.backgroundFlusher()
return l return l
...@@ -245,6 +248,6 @@ func main() { ...@@ -245,6 +248,6 @@ func main() {
} }
tlsConf := audit.TLSClientAuthConfigWithCerts(*sslCa, *sslCert, *sslKey) tlsConf := audit.TLSClientAuthConfigWithCerts(*sslCa, *sslCert, *sslKey)
locald := newLocalServer(*spoolDir, *serverUrl+"/api/1/write", tlsConf) locald := newLocalServer(*spoolDir, *serverUrl, tlsConf)
log.Fatal(locald.Serve(*socketPath)) log.Fatal(locald.Serve(*socketPath))
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment