Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

feat(control-api): expose authEnabled on the registry connect-status endpoint

Jose Ramirez83c02a1a42d9
diff --git a/control-api/src/routes/admin/registryConnect.ts b/control-api/src/routes/admin/registryConnect.ts
index 57b5b1379..821904d52 100644
--- a/control-api/src/routes/admin/registryConnect.ts
+++ b/control-api/src/routes/admin/registryConnect.ts
@@ -88,13 +88,16 @@ export function createRegistryConnectRouter(): Router {
if (!ctx) return
const row = await getRegistryConnection()
if (!row) {
- res.status(200).json({ state: 'disconnected' })
+ res.status(200).json({ state: 'disconnected', authEnabled: config.registryAuthEnabled })
return
}
if (row.status === 'connected') {
- res
- .status(200)
- .json({ state: 'connected', deploymentId: row.deploymentId, org: row.orgName })
+ res.status(200).json({
+ state: 'connected',
+ deploymentId: row.deploymentId,
+ org: row.orgName,
+ authEnabled: config.registryAuthEnabled,
+ })
return
}
// Not yet connected — poll the registry so an operator approval (or
@@ -115,6 +118,7 @@ export function createRegistryConnectRouter(): Router {
state,
deploymentId: row.deploymentId,
requestedOrgName: row.requestedOrgName,
+ authEnabled: config.registryAuthEnabled,
})
} catch (err) {
next(err)
diff --git a/control-api/test/routes.registryConnect.test.ts b/control-api/test/routes.registryConnect.test.ts
index 3046a7a4a..d3d25012c 100644
--- a/control-api/test/routes.registryConnect.test.ts
+++ b/control-api/test/routes.registryConnect.test.ts
@@ -62,14 +62,39 @@ beforeEach(() => {
status: 'active',
})
cfg.registryConnectionMode = 'self-hosted'
+ cfg.registryAuthEnabled = true
})
afterEach(() => vi.restoreAllMocks())
describe('registry connect flow', () => {
it('GET → disconnected when no row', async () => {
+ cfg.registryAuthEnabled = true
connDb.getRegistryConnection.mockResolvedValue(null)
const res = await request(app()).get('/admin/registry/connect').expect(200)
expect(res.body.state).toBe('disconnected')
+ expect(res.body.authEnabled).toBe(true)
+ })
+
+ it('GET connected → includes authEnabled reflecting config (true)', async () => {
+ cfg.registryAuthEnabled = true
+ connDb.getRegistryConnection.mockResolvedValue({
+ status: 'connected',
+ deploymentId: 'dep-9',
+ orgName: 'acme',
+ })
+ const res = await request(app()).get('/admin/registry/connect').expect(200)
+ expect(res.body).toMatchObject({ state: 'connected', org: 'acme', authEnabled: true })
+ })
+
+ it('GET connected → includes authEnabled reflecting config (false)', async () => {
+ cfg.registryAuthEnabled = false
+ connDb.getRegistryConnection.mockResolvedValue({
+ status: 'connected',
+ deploymentId: 'dep-9',
+ orgName: 'acme',
+ })
+ const res = await request(app()).get('/admin/registry/connect').expect(200)
+ expect(res.body).toMatchObject({ state: 'connected', org: 'acme', authEnabled: false })
})
it('409 not_self_hosted in managed mode', async () => {
@@ -92,7 +117,7 @@ describe('registry connect flow', () => {
})
)
const res = await request(app()).get('/admin/registry/connect').expect(200)
- expect(res.body).toMatchObject({ state: 'approved', deploymentId: 'dep-9' })
+ expect(res.body).toMatchObject({ state: 'approved', deploymentId: 'dep-9', authEnabled: true })
// it actually polled the registry status endpoint with a DPoP header
const [url, init] = fetchSpy.mock.calls[0]
expect(String(url)).toContain('/api/v1/deployments/dep-9/status')