Add hooks overrides support with environment variables

- Added WG_PRE_UP, WG_POST_UP, WG_PRE_DOWN, WG_POST_DOWN environment variables
- Created applyHooksOverrides() helper function
- Updated WireGuard service to apply hooks overrides when generating config
- Updated /api/admin/overrides endpoint to include hooks override information
- Updated documentation with hooks environment variables

Co-authored-by: kaaax0815 <32197462+kaaax0815@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-11-14 14:10:07 +00:00
parent 268916782d
commit c1d5822f41
4 changed files with 43 additions and 1 deletions
+2 -1
View File
@@ -27,10 +27,11 @@ class WireGuard {
async #saveWireguardConfig(wgInterface: InterfaceType) {
const clients = await Database.clients.getAll();
const hooks = await Database.hooks.get();
const hooksWithOverrides = applyHooksOverrides(hooks);
const result = [];
result.push(
wg.generateServerInterface(wgInterface, hooks, {
wg.generateServerInterface(wgInterface, hooksWithOverrides, {
enableIpv6: !WG_ENV.DISABLE_IPV6,
})
);