feat(agent): add durable existing-agent credential transitions
This commit is contained in:
1 parent
abf5654a25
commit
3cfb0d1abe
33 files changed
+3828
-54
No files matched your search
+20
-27
@@ -25102,37 +25102,30 @@ async def startup_ensure_minerops_agent_tables():
|
||||
|
||||
|
||||
@app.get("/api/agent/config")
|
||||
async def minerops_agent_config(request: Request):
|
||||
minerops_require_agent_secret(request)
|
||||
async def minerops_agent_config(
|
||||
request: Request,
|
||||
authenticated_agent_id: str = Depends(require_agent_identity),
|
||||
zone_service: AgentZoneService = Depends(get_agent_zone_service),
|
||||
):
|
||||
routing = zone_service.routing_context(authenticated_agent_id)
|
||||
if routing.routing_reason or routing.agent_zone_id is None:
|
||||
raise HTTPException(
|
||||
status_code=409,
|
||||
detail=(
|
||||
"Agent routing unavailable: "
|
||||
+ (routing.routing_reason or "agent_zone_unassigned")
|
||||
),
|
||||
)
|
||||
|
||||
configuration = zone_service.configuration(authenticated_agent_id)
|
||||
if not configuration:
|
||||
raise HTTPException(status_code=409, detail="Agent configuration unavailable")
|
||||
|
||||
return {
|
||||
"ok": True,
|
||||
"site_name": "Plexus",
|
||||
**configuration,
|
||||
"poll_interval_seconds": 120,
|
||||
"hub_url": "https://plexus.lussier.cc",
|
||||
"ip_ranges": [
|
||||
{
|
||||
"name": "Unit 4",
|
||||
"cidr": "10.30.0.0/22",
|
||||
"enabled": True,
|
||||
"api_port": 4028,
|
||||
"api3_port": 4433,
|
||||
},
|
||||
{
|
||||
"name": "Unit 6",
|
||||
"cidr": "10.80.0.0/22",
|
||||
"enabled": True,
|
||||
"api_port": 4028,
|
||||
"api3_port": 4433,
|
||||
},
|
||||
{
|
||||
"name": "Unit 12",
|
||||
"cidr": "10.90.0.0/22",
|
||||
"enabled": False,
|
||||
"api_port": 4028,
|
||||
"api3_port": 4433,
|
||||
},
|
||||
],
|
||||
"hub_url": str(request.base_url).rstrip("/"),
|
||||
"message": "Agent config from hub.",
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user