chore(TALE-29): remove acl from integration/context

This commit is contained in:
Aarnav Tale 2024-08-24 10:12:30 -04:00
parent a72a3d6e5f
commit 690b52d8c6
No known key found for this signature in database
8 changed files with 1 additions and 62 deletions

View File

@ -10,7 +10,6 @@ import TabLink from './TabLink'
interface Properties { interface Properties {
readonly data?: { readonly data?: {
acl: HeadplaneContext['acl']
config: HeadplaneContext['config'] config: HeadplaneContext['config']
user?: SessionData['user'] user?: SessionData['user']
} }

View File

@ -88,36 +88,6 @@ export default createIntegration<Context>({
return context.client !== undefined return context.client !== undefined
}, },
onAclChange: async (context) => {
if (!context.client || !context.container) {
return
}
log.info('INTG', 'Sending SIGHUP to Headscale via Docker')
let attempts = 0
while (attempts <= context.maxAttempts) {
const response = await context.client.request({
method: 'POST',
path: `/v1.30/containers/${context.container}/kill?signal=SIGHUP`,
})
if (response.statusCode !== 204) {
if (attempts < context.maxAttempts) {
attempts++
await setTimeout(1000)
continue
}
const stringCode = response.statusCode.toString()
const body = await response.body.text()
throw new Error(`API request failed: ${stringCode} ${body}`)
}
break
}
},
onConfigChange: async (context) => { onConfigChange: async (context) => {
if (!context.client || !context.container) { if (!context.client || !context.container) {
return return

View File

@ -3,7 +3,6 @@ export interface IntegrationFactory<T = any> {
name: string name: string
context: T context: T
isAvailable: (context: T) => Promise<boolean> | boolean isAvailable: (context: T) => Promise<boolean> | boolean
onAclChange?: (context: T) => Promise<void> | void
onConfigChange?: (context: T) => Promise<void> | void onConfigChange?: (context: T) => Promise<void> | void
} }

View File

@ -177,15 +177,6 @@ export default createIntegration<Context>({
} }
}, },
onAclChange: (context) => {
if (!context.pid) {
return
}
log.info('INTG', 'Sending SIGHUP to Headscale')
kill(context.pid, 'SIGHUP')
},
onConfigChange: (context) => { onConfigChange: (context) => {
if (!context.pid) { if (!context.pid) {
return return

View File

@ -70,14 +70,5 @@ export default createIntegration<Context>({
log.error('INTG', 'Failed to read /proc') log.error('INTG', 'Failed to read /proc')
return false return false
} }
}, }
onAclChange: (context) => {
if (!context.pid) {
return
}
log.info('INTG', 'Sending SIGHUP to Headscale')
kill(context.pid, 'SIGHUP')
},
}) })

View File

@ -82,10 +82,6 @@ export async function action({ request }: ActionFunctionArgs) {
}) })
} }
if (context.integration?.onAclChange) {
await context.integration.onAclChange(context.integration.context)
}
return json({ success: true }) return json({ success: true })
} }

View File

@ -35,7 +35,6 @@ export async function loader({ request }: LoaderFunctionArgs) {
const context = await loadContext() const context = await loadContext()
return { return {
acl: context.acl,
config: context.config, config: context.config,
user: session.get('user'), user: session.get('user'),
} }

View File

@ -22,11 +22,6 @@ export interface HeadplaneContext {
write: boolean write: boolean
} }
acl: {
read: boolean
write: boolean
}
oidc?: { oidc?: {
issuer: string issuer: string
client: string client: string
@ -69,7 +64,6 @@ export async function loadContext(): Promise<HeadplaneContext> {
cookieSecret, cookieSecret,
integration: await loadIntegration(), integration: await loadIntegration(),
config: contextData, config: contextData,
acl: await checkAcl(config),
oidc: await checkOidc(config), oidc: await checkOidc(config),
} }