mirror of
https://github.com/tale/headplane.git
synced 2026-07-29 00:58:55 +00:00
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:
committed by
Aarnav Tale
parent
b1da29b2fb
commit
5e60ac1208
@@ -0,0 +1,3 @@
|
||||
export function isHeadscaleServeCmd(cmdline: string): boolean {
|
||||
return cmdline.includes('headscale') && cmdline.includes("serve");
|
||||
}
|
||||
@@ -8,6 +8,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';
|
||||
|
||||
// TODO: Upgrade to the new CoreV1Api from @kubernetes/client-node
|
||||
type T = NonNullable<HeadplaneConfig['integration']>['kubernetes'];
|
||||
@@ -162,7 +163,7 @@ export default class KubernetesIntegration 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) {
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user