Update config module to lazy initialize
This will load config on first access, not at module import time
MODIFY
plex_trakt_sync/config.py
plex_trakt_sync/config.py
import json
from plex_trakt_sync.path import config_file
-with open(config_file, 'r') as fp:
- CONFIG = json.load(fp)
\ No newline at end of file
+
+class Config(dict):
+ initialized = False
+
+ def __getitem__(self, item):
+ if not self.initialized:
+ self.initialize()
+ return dict.__getitem__(self, item)
+
+ def initialize(self):
+ with open(config_file, "r") as fp:
+ config = json.load(fp)
+ self.update(config)
+ self.initialized = True
+
+
+CONFIG = Config()
\ No newline at end of file

Update config module to lazy initialize

This will load config on first access, not at module import time