security: remove all hardcoded API keys, require from environment
This commit is contained in:
@@ -105,8 +105,8 @@ python3 client.py --url http://localhost:8000 --api-key your_key submit inferenc
|
||||
```
|
||||
|
||||
Default credentials:
|
||||
- Client API Key: `REDACTED_CLIENT_KEY`
|
||||
- Miner API Key: `REDACTED_MINER_KEY`
|
||||
- Client API Key: `${CLIENT_API_KEY}`
|
||||
- Miner API Key: `${MINER_API_KEY}`
|
||||
|
||||
## Examples
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ from typing import Optional
|
||||
|
||||
# Configuration
|
||||
DEFAULT_COORDINATOR = "http://127.0.0.1:18000"
|
||||
DEFAULT_API_KEY = "REDACTED_CLIENT_KEY"
|
||||
DEFAULT_API_KEY = "${CLIENT_API_KEY}"
|
||||
|
||||
class AITBCClient:
|
||||
def __init__(self, coordinator_url: str, api_key: str):
|
||||
|
||||
@@ -13,7 +13,7 @@ from typing import Optional
|
||||
|
||||
# Configuration
|
||||
DEFAULT_COORDINATOR = "http://localhost:8001"
|
||||
DEFAULT_API_KEY = "REDACTED_MINER_KEY"
|
||||
DEFAULT_API_KEY = "${MINER_API_KEY}"
|
||||
DEFAULT_MINER_ID = "cli-miner"
|
||||
|
||||
class AITBCMiner:
|
||||
|
||||
@@ -11,7 +11,7 @@ import sys
|
||||
|
||||
# Configuration
|
||||
DEFAULT_COORDINATOR = "http://localhost:8001"
|
||||
DEFAULT_API_KEY = "REDACTED_MINER_KEY"
|
||||
DEFAULT_API_KEY = "${MINER_API_KEY}"
|
||||
DEFAULT_MINER_ID = "localhost-gpu-miner"
|
||||
|
||||
def test_miner_registration(coordinator_url):
|
||||
@@ -72,7 +72,7 @@ def test_job_processing(coordinator_url):
|
||||
f"{coordinator_url}/v1/jobs",
|
||||
headers={
|
||||
"Content-Type": "application/json",
|
||||
"X-Api-Key": "REDACTED_CLIENT_KEY"
|
||||
"X-Api-Key": "${CLIENT_API_KEY}"
|
||||
},
|
||||
json={
|
||||
"payload": {
|
||||
|
||||
@@ -19,7 +19,7 @@ import httpx
|
||||
# Configuration
|
||||
DEFAULT_COORDINATOR = "http://127.0.0.1:18000"
|
||||
DEFAULT_BLOCKCHAIN = "http://127.0.0.1:19000"
|
||||
DEFAULT_API_KEY = "REDACTED_CLIENT_KEY"
|
||||
DEFAULT_API_KEY = "${CLIENT_API_KEY}"
|
||||
DEFAULT_PROMPT = "What is the capital of France?"
|
||||
DEFAULT_MODEL = "llama3.2:latest"
|
||||
DEFAULT_TIMEOUT = 180
|
||||
@@ -150,7 +150,7 @@ def main() -> int:
|
||||
# Check miner registration
|
||||
print("\n📋 Checking miner registration...")
|
||||
with httpx.Client() as client:
|
||||
miner_info = get_miner_info(client, args.coordinator_url, "REDACTED_ADMIN_KEY")
|
||||
miner_info = get_miner_info(client, args.coordinator_url, "${ADMIN_API_KEY}")
|
||||
if miner_info:
|
||||
print(f"✅ Found registered miner: {miner_info.get('miner_id')}")
|
||||
print(f" Status: {miner_info.get('status')}")
|
||||
|
||||
@@ -12,7 +12,7 @@ from typing import Optional
|
||||
import httpx
|
||||
|
||||
DEFAULT_COORDINATOR = "http://127.0.0.1:18000"
|
||||
DEFAULT_API_KEY = "REDACTED_CLIENT_KEY"
|
||||
DEFAULT_API_KEY = "${CLIENT_API_KEY}"
|
||||
DEFAULT_PROMPT = "hello"
|
||||
DEFAULT_TIMEOUT = 180
|
||||
POLL_INTERVAL = 3
|
||||
|
||||
Reference in New Issue
Block a user