feat: configure support for generic integrations
Co-authored-by: Gage Orsburn <gageorsburn@live.com>
This commit is contained in:
parent
1a30185047
commit
f0e4868252
10 changed files with 289 additions and 148 deletions
|
|
@ -9,7 +9,6 @@ import Link from '~/components/Link'
|
|||
import Notice from '~/components/Notice'
|
||||
import { cn } from '~/utils/cn'
|
||||
import { loadAcl, loadContext, patchAcl } from '~/utils/config/headplane'
|
||||
import { sighupHeadscale } from '~/utils/docker'
|
||||
import { getSession } from '~/utils/sessions'
|
||||
|
||||
import Editor from './editor'
|
||||
|
|
@ -47,8 +46,8 @@ export async function action({ request }: ActionFunctionArgs) {
|
|||
const data = await request.json() as { acl: string }
|
||||
await patchAcl(data.acl)
|
||||
|
||||
if (context.docker) {
|
||||
await sighupHeadscale()
|
||||
if (context.integration?.sighup) {
|
||||
await context.integration.sighup()
|
||||
}
|
||||
|
||||
return json({ success: true })
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import Code from '~/components/Code'
|
|||
import Notice from '~/components/Notice'
|
||||
import { loadContext } from '~/utils/config/headplane'
|
||||
import { loadConfig, patchConfig } from '~/utils/config/headscale'
|
||||
import { restartHeadscale } from '~/utils/docker'
|
||||
import { getSession } from '~/utils/sessions'
|
||||
import { useLiveData } from '~/utils/useLiveData'
|
||||
|
||||
|
|
@ -56,7 +55,11 @@ export async function action({ request }: ActionFunctionArgs) {
|
|||
|
||||
const data = await request.json() as Record<string, unknown>
|
||||
await patchConfig(data)
|
||||
await restartHeadscale()
|
||||
|
||||
if (context.integration?.restart) {
|
||||
await context.integration.restart()
|
||||
}
|
||||
|
||||
return json({ success: true })
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ export async function loader({ request }: LoaderFunctionArgs) {
|
|||
|
||||
const context = await loadContext()
|
||||
return {
|
||||
...context,
|
||||
acl: context.acl,
|
||||
config: context.config,
|
||||
user: session.get('user'),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue