Avoid loading CONFIG in cli.py too early
Get PLEX_USERNAME from config only when really needed
MODIFY
plextraktsync/cli.py
plextraktsync/cli.py
from plextraktsync.factory import factory
-CONFIG = factory.config
-
def command():
"""
@@ -120,11 +118,18 @@ def login():
pass
+def env_plex_username():
+ from plextraktsync.factory import factory
+ config = factory.config()
+
+ return environ.get("PLEX_USERNAME", config["PLEX_USERNAME"])
+
+
@command()
@click.option(
"--username",
help="Plex login",
- default=lambda: environ.get("PLEX_USERNAME", CONFIG["PLEX_USERNAME"]),
+ default=env_plex_username,
)
@click.option(
"--password",

Avoid loading CONFIG in cli.py too early

Get PLEX_USERNAME from config only when really needed