fix(TALE-7): don't destructure context otherwise it won't set properly
This commit is contained in:
parent
6b278309ed
commit
b170e11dd6
3 changed files with 46 additions and 38 deletions
|
|
@ -16,7 +16,7 @@ export default createIntegration<Context>({
|
|||
context: {
|
||||
pid: undefined,
|
||||
},
|
||||
isAvailable: async ({ pid }) => {
|
||||
isAvailable: async (context) => {
|
||||
if (platform() !== 'linux') {
|
||||
log.error('INTG', '/proc is only available on Linux')
|
||||
return false
|
||||
|
|
@ -63,8 +63,8 @@ export default createIntegration<Context>({
|
|||
return false
|
||||
}
|
||||
|
||||
pid = pids[0]
|
||||
log.info('INTG', 'Found Headscale process with PID: %d', pid)
|
||||
context.pid = pids[0]
|
||||
log.info('INTG', 'Found Headscale process with PID: %d', context.pid)
|
||||
return true
|
||||
} catch {
|
||||
log.error('INTG', 'Failed to read /proc')
|
||||
|
|
@ -72,12 +72,12 @@ export default createIntegration<Context>({
|
|||
}
|
||||
},
|
||||
|
||||
onAclChange: ({ pid }) => {
|
||||
if (!pid) {
|
||||
onAclChange: (context) => {
|
||||
if (!context.pid) {
|
||||
return
|
||||
}
|
||||
|
||||
log.info('INTG', 'Sending SIGHUP to Headscale')
|
||||
kill(pid, 'SIGHUP')
|
||||
kill(context.pid, 'SIGHUP')
|
||||
},
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue