Skip to content

Commit

Permalink
Merge pull request #564 from MyElectricalData/feat/build-args
Browse files Browse the repository at this point in the history
fix: influxdb method lower
  • Loading branch information
m4dm4rtig4n authored Jul 31, 2024
2 parents a538c35 + 2848e9b commit 8e1ed22
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ influxdb:
token: my-token
org: myorg
bucket: mybucket
method: SYNCHRONOUS
method: synchronous
timezone: UTC
wipe: false
batching_options:
Expand Down
12 changes: 6 additions & 6 deletions src/config/influxdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ class Method:
"""InfluxDB Method."""

def __init__(self) -> None:
self.synchronous: str = "SYNCHRONOUS"
self.asynchronous: str = "ASYNCHRONOUS"
self.batching: str = "BATCHING"
self.synchronous: str = "synchronous"
self.asynchronous: str = "asynchronous"
self.batching: str = "batching"


class InfluxDB:
Expand Down Expand Up @@ -263,17 +263,17 @@ def load(self): # noqa: PLR0912, C901, PLR0915
self.change(sub_key, self.default()[sub_key], False)
try:
sub_key = "method"
current_method = self.config[self.key][sub_key]
current_method = self.config[self.key][sub_key].lower()
method = Method()
method_available = ""
for value in method.__dict__.values():
method_available += f"{value}, "
if current_method not in method.__dict__.values():
sys.exit(
f'[InfluxDB] Erreur de configuration, la méthode "{current_method}" '
"n'éxiste pas. ({method_available[:-2]})"
f"n'éxiste pas. ({method_available[:-2]})"
)
self.change(sub_key, self.config[self.key][sub_key], False)
self.change(sub_key, self.config[self.key][sub_key].lower(), False)
except Exception:
self.change(sub_key, self.default()[sub_key], False)
try:
Expand Down
2 changes: 1 addition & 1 deletion src/templates/config.example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ influxdb:
token: my-token
org: myorg
bucket: mybucket
method: SYNCHRONOUS
method: synchronous
timezone: UTC
wipe: false
batching_options:
Expand Down

0 comments on commit 8e1ed22

Please sign in to comment.