fix: remove hardcoded LAN IP from default base_url (issue #5)

- Replace hardcoded 192.168.8.223:11434 with error placeholder
- Fail loudly if CLOVER_BASE_URL not set in .env
- Add helpful error message in validate_config()
This commit is contained in:
opencode 2026-07-05 07:01:34 +00:00
parent b25fb3c1c6
commit 1207f2c9cf

View File

@ -29,7 +29,9 @@ def load_config():
"threads": int(os.getenv("CLOVER_THREADS", "5")), "threads": int(os.getenv("CLOVER_THREADS", "5")),
"model": os.getenv("CLOVER_MODEL", "qwen3-coder:30b"), "model": os.getenv("CLOVER_MODEL", "qwen3-coder:30b"),
"api_key": os.getenv("CLOVER_API_KEY"), "api_key": os.getenv("CLOVER_API_KEY"),
"base_url": os.getenv("CLOVER_BASE_URL", "http://192.168.8.223:11434"), "base_url": os.getenv(
"CLOVER_BASE_URL", "error-set-CLOVER_BASE_URL-in-.env-file"
),
"debug": os.getenv("CLOVER_DEBUG", "false").lower() == "true", "debug": os.getenv("CLOVER_DEBUG", "false").lower() == "true",
"verbose": os.getenv("CLOVER_VERBOSE", "false").lower() == "true", "verbose": os.getenv("CLOVER_VERBOSE", "false").lower() == "true",
"cache_enabled": os.getenv("CLOVER_CACHE_ENABLED", "true").lower() == "true", "cache_enabled": os.getenv("CLOVER_CACHE_ENABLED", "true").lower() == "true",
@ -205,8 +207,12 @@ def validate_config():
issues = [] issues = []
# Check required settings # Check required settings
if not config.get("base_url"): base_url = config.get("base_url", "")
issues.append("base_url is required") if not base_url or base_url.startswith("error-set-"):
issues.append(
"CLOVER_BASE_URL is not set. Set it in your .env file or environment. "
"Example: CLOVER_BASE_URL=http://localhost:11434"
)
# Check numeric values # Check numeric values
try: try: