Skip to content

Commit

Permalink
fix influxdb2 setup
Browse files Browse the repository at this point in the history
  • Loading branch information
wuan committed Nov 28, 2023
1 parent 16fe299 commit 9be46b9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
14 changes: 9 additions & 5 deletions klimalogger/store/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@

log = logging.getLogger(__name__)

def influxdb_store_factory(config: Config):
if config.store_org is not None:
from .influxdb2 import InfluxDbStore
return InfluxDbStore(config)
else:
from .influxdb import InfluxDbStore
return InfluxDbStore(config)

class StoreModule(Module):
@provider
@singleton
Expand All @@ -16,9 +24,5 @@ def store_provider(self, config: Config) -> StoreClient:
if config.store_type == 'queue':
from .queue import CombinedStore
return CombinedStore(config)
elif config.store_org is not None:
from .influxdb2 import InfluxDbStore
return InfluxDbStore(config)
else:
from .influxdb import InfluxDbStore
return InfluxDbStore(config)
return influxdb_store_factory(config)
4 changes: 2 additions & 2 deletions klimalogger/store/queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
from injector import inject
from paho.mqtt import client as mqtt_client

from . import influxdb_store_factory
from .client import StoreClient
from .influxdb import InfluxDbStore
from .. import config

log = logging.getLogger(__name__)
Expand All @@ -18,7 +18,7 @@ class CombinedStore(StoreClient):
def __init__(self, configuration: config.Config):
log.info("create combined store")
self.stores = [
InfluxDbStore(configuration),
influxdb_store_factory(configuration),
QueueStore(configuration)
]

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "klimalogger"
version = "0.6.9"
version = "0.6.10"
authors = [
{ name = "Andreas Würl", email = "[email protected]" },
]
Expand Down

0 comments on commit 9be46b9

Please sign in to comment.