feat: add new HeadscaleManager

This commit is contained in:
DecDuck
2025-05-09 14:53:37 +10:00
parent a0bc4bbc4c
commit efbc86e73e
3 changed files with 150 additions and 1 deletions

View File

@ -0,0 +1,25 @@
import type { HeadscaleService} from "@drop-oss/headscalez";
import { startHeadscale } from "@drop-oss/headscalez";
export class HeadscaleManager {
private headscaleService?: HeadscaleService;
constructor() {
this.setup();
}
async setup() {
const externalUrl = process.env.CONTROL_URL;
if (externalUrl) {
const headscale = await startHeadscale({ externalUrl });
this.headscaleService = headscale;
}
}
enabled() {
return !!this.headscaleService;
}
}
export const headscaleManager = new HeadscaleManager();
export default headscaleManager;