diff --git a/config.json b/config.json index e4f936e..faff415 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,6 @@ { "remote_url": "http://192.168.1.3:8188", "timeout": 30, - "path_mappings": {} + "path_mappings": {}, + "civitai_api_key": "" } diff --git a/config.py b/config.py index a559d05..263f89e 100644 --- a/config.py +++ b/config.py @@ -19,6 +19,7 @@ class RemoteConfig: self.remote_url: str = "" self.timeout: int = 30 self.path_mappings: dict[str, str] = {} + self.civitai_api_key: str = "" self._load() # ------------------------------------------------------------------ @@ -35,6 +36,7 @@ class RemoteConfig: self.remote_url = data.get("remote_url", "") self.timeout = int(data.get("timeout", 30)) self.path_mappings = data.get("path_mappings", {}) + self.civitai_api_key = data.get("civitai_api_key", "") except Exception as exc: logger.warning("[LM-Remote] Failed to read config.json: %s", exc) @@ -44,6 +46,10 @@ class RemoteConfig: if env_timeout: self.timeout = int(env_timeout) + env_api_key = os.environ.get("LM_CIVITAI_API_KEY", "") + if env_api_key: + self.civitai_api_key = env_api_key + # Strip trailing slash self.remote_url = self.remote_url.rstrip("/")