Skip to content

Commit

Permalink
Assign database
Browse files Browse the repository at this point in the history
  • Loading branch information
dlmcpaul committed Dec 18, 2022
1 parent b1d1b74 commit 5283629
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/java/com/hz/configuration/InfluxDBConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ public String get(String k) {
public InfluxDB destinationInfluxDB() {
log.info("Writing solar stats to influx database at {}", config.getInfluxdbResource().getUrl());

InfluxDB database = null;
InfluxDB database;

if (config.getInfluxdbResource().getUser() == null || config.getInfluxdbResource().getUser().isEmpty()) {
InfluxDBFactory.connect(config.getInfluxdbResource().getUrl());
database = InfluxDBFactory.connect(config.getInfluxdbResource().getUrl());
} else {
InfluxDBFactory.connect(config.getInfluxdbResource().getUrl(), config.getInfluxdbResource().getUser(), config.getInfluxdbResource().getPassword());
database = InfluxDBFactory.connect(config.getInfluxdbResource().getUrl(), config.getInfluxdbResource().getUser(), config.getInfluxdbResource().getPassword());
}
database.query(new Query("CREATE DATABASE \"" + DATABASE_NAME + "\" WITH DURATION 365d", DATABASE_NAME));

Expand Down

0 comments on commit 5283629

Please sign in to comment.