Server Keys env update
This commit is contained in:
parent
fd382ccb93
commit
f538371116
|
|
@ -5,8 +5,8 @@ const WG_CONF = "/etc/wireguard/wg0.conf";
|
|||
const PEER_DB = "/etc/wireguard/peers.json";
|
||||
const CLIENT_DIR = "/etc/wireguard/clients";
|
||||
|
||||
const SERVER_PUBLIC_KEY = "<SERVER_PUBLIC_KEY>";
|
||||
const SERVER_IP = "<SERVER_PUBLIC_IP>";
|
||||
const SERVER_PUBLIC_KEY = process.env.SERVER_PUBLIC_KEY || "<SERVER_PUBLIC_KEY>";
|
||||
const SERVER_IP = process.env.SERVER_PUBLIC_IP || "<SERVER_PUBLIC_IP>";
|
||||
|
||||
function loadDb() {
|
||||
try {
|
||||
|
|
@ -69,7 +69,7 @@ function addPeerToServer(publicKey, ip) {
|
|||
execSync("wg-quick strip wg0 > /tmp/wg0.tmp");
|
||||
execSync("wg syncconf wg0 /tmp/wg0.tmp");
|
||||
execSync("rm -f /tmp/wg0.tmp");
|
||||
|
||||
|
||||
execSync(
|
||||
`wg set wg0 peer ${publicKey} allowed-ips ${ip}/32`,
|
||||
{ stdio: "inherit" }
|
||||
|
|
|
|||
Loading…
Reference in New Issue