Commit 737d983f authored by neop's avatar neop
Browse files

try out authentication again

parent 19b51f67
......@@ -80,9 +80,12 @@ public class Main {
influxDBClient = InfluxDBClientFactory.create(
InfluxDBClientOptions.builder()
.url(Main.influxdb_uri)
.authenticateToken("hunter2".toCharArray())
.bucket("bucket0")
.org("openforecast")
.authenticateToken(String.format("%s:%s",
System.getenv("SENSOR2GRAPH_INFLUXDB_PASS"),
System.getenv("SENSOR2GRAPH_INFLUXDB_USER")
).toCharArray())
.bucket(Main.influxdb_database_name)
.org("-")
.okHttpClient(
new OkHttpClient().newBuilder()
.connectTimeout(10, TimeUnit.MINUTES)
......@@ -109,21 +112,22 @@ public class Main {
}
private static void run() throws Exception {
// System.out.println("starting influx query");
// var tables = influxDBClient.getQueryApi().query("from(bucket:\"bucket0\") |> range(start: -10000d1h, stop: -1d)");
System.out.println("starting influx query");
var tables = influxDBClient.getQueryApi().query(String.format("from(bucket:\"%s\") |> range(start: -600d1m, stop: -600d)", Main.influxdb_database_name));
// for (var fluxTable : tables) {
// System.out.println("table " + fluxTable);
// for (var record : fluxTable.getRecords()) {
// System.out.println(String.format("%s %s: %s %s", record.getTime(), record.getMeasurement(), record.getField(), record.getValue()));
// record.getValues().forEach((key, value) -> System.out.println(key + ":" + value));
// }
// }
// System.out.println("finished influx query");
try_uploading_failed_sensors();
upload_all_days();
try_uploading_failed_sensors();
System.out.println("hello");
for (var fluxTable : tables) {
System.out.println("table " + fluxTable);
for (var record : fluxTable.getRecords()) {
System.out.println(String.format("%s %s: %s %s", record.getTime(), record.getMeasurement(), record.getField(), record.getValue()));
record.getValues().forEach((key, value) -> System.out.println(key + ":" + value));
}
}
System.out.println("finished influx query");
// try_uploading_failed_sensors();
// upload_all_days();
// try_uploading_failed_sensors();
}
private static void try_uploading_failed_sensors() throws Exception {
......@@ -229,7 +233,7 @@ public class Main {
}
private static void initialize_config_vars() throws Exception{
private static void initialize_config_vars() throws Exception {
Properties config = load_user_defined_properties_with_defaults(get_default_properties());
already_uploaded_days_file = config.getProperty("already_uploaded_days_file" );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment