Server Keys env update

This commit is contained in:
=bhagwanSingh 2025-12-16 11:47:27 +05:30
parent fd382ccb93
commit f538371116
1 changed files with 3 additions and 3 deletions

View File

@ -5,8 +5,8 @@ const WG_CONF = "/etc/wireguard/wg0.conf";
const PEER_DB = "/etc/wireguard/peers.json"; const PEER_DB = "/etc/wireguard/peers.json";
const CLIENT_DIR = "/etc/wireguard/clients"; const CLIENT_DIR = "/etc/wireguard/clients";
const SERVER_PUBLIC_KEY = "<SERVER_PUBLIC_KEY>"; const SERVER_PUBLIC_KEY = process.env.SERVER_PUBLIC_KEY || "<SERVER_PUBLIC_KEY>";
const SERVER_IP = "<SERVER_PUBLIC_IP>"; const SERVER_IP = process.env.SERVER_PUBLIC_IP || "<SERVER_PUBLIC_IP>";
function loadDb() { function loadDb() {
try { try {
@ -69,7 +69,7 @@ function addPeerToServer(publicKey, ip) {
execSync("wg-quick strip wg0 > /tmp/wg0.tmp"); execSync("wg-quick strip wg0 > /tmp/wg0.tmp");
execSync("wg syncconf wg0 /tmp/wg0.tmp"); execSync("wg syncconf wg0 /tmp/wg0.tmp");
execSync("rm -f /tmp/wg0.tmp"); execSync("rm -f /tmp/wg0.tmp");
execSync( execSync(
`wg set wg0 peer ${publicKey} allowed-ips ${ip}/32`, `wg set wg0 peer ${publicKey} allowed-ips ${ip}/32`,
{ stdio: "inherit" } { stdio: "inherit" }