with auth
This commit is contained in:
parent
562ee0d16c
commit
b0257f5888
10
src/influx.c
10
src/influx.c
@ -6,10 +6,13 @@
|
||||
#include <unistd.h>
|
||||
|
||||
|
||||
const char INFLUXURL[] = "http://172.16.3.15:8086/write?db=smarthome2&precision=ms";
|
||||
const char INFLUXURL[] = "https://home.hottis.de/influx/write?db=smarthome2&precision=ms";
|
||||
const char INFLUXUSER[] = "secundus";
|
||||
const char INFLUXPASS[] = "geheim";
|
||||
|
||||
// #define BUFSIZE 131070
|
||||
#define BUFSIZE 65535
|
||||
// #define BUFSIZE 1024
|
||||
char influxBuffer[BUFSIZE];
|
||||
char *bufferNextEntry;
|
||||
|
||||
@ -23,11 +26,12 @@ void influxInit() {
|
||||
}
|
||||
|
||||
static void influxSendRequest() {
|
||||
//printf("About to send:\n");
|
||||
//printf(influxBuffer);
|
||||
CURL *curl = curl_easy_init();
|
||||
if(curl) {
|
||||
curl_easy_setopt(curl, CURLOPT_URL, INFLUXURL);
|
||||
curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST);
|
||||
curl_easy_setopt(curl, CURLOPT_USERNAME, INFLUXUSER);
|
||||
curl_easy_setopt(curl, CURLOPT_PASSWORD, INFLUXPASS);
|
||||
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, influxBuffer);
|
||||
CURLcode res = curl_easy_perform(curl);
|
||||
if(res != CURLE_OK) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user