fix: improve headscale proc detection
Check if command line also includes 'serve'. Move command line processing logic into a helper function.
This commit is contained in:
parent
b1da29b2fb
commit
5e60ac1208
3 changed files with 7 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ import { ApiClient } from '~/server/headscale/api-client';
|
|||
import log from '~/utils/log';
|
||||
import { HeadplaneConfig } from '../schema';
|
||||
import { Integration } from './abstract';
|
||||
import { isHeadscaleServeCmd } from './cmdline.ts';
|
||||
|
||||
type T = NonNullable<HeadplaneConfig['integration']>['proc'];
|
||||
export default class ProcIntegration extends Integration<T> {
|
||||
|
|
@ -38,7 +39,7 @@ export default class ProcIntegration extends Integration<T> {
|
|||
try {
|
||||
log.debug('config', 'Reading %s', path);
|
||||
const data = await readFile(path, 'utf8');
|
||||
if (data.includes('headscale')) {
|
||||
if (isHeadscaleServeCmd(data)) {
|
||||
return pid;
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue