feat: add civitai_api_key to config
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+2
-1
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"remote_url": "http://192.168.1.3:8188",
|
||||
"timeout": 30,
|
||||
"path_mappings": {}
|
||||
"path_mappings": {},
|
||||
"civitai_api_key": ""
|
||||
}
|
||||
|
||||
@@ -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("/")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user