gluon/package/gluon-mesh-vpn-wireguard/files/usr/bin/gluon-mesh-vpn-wireguard-get-or-create-secret
2020-03-09 22:46:43 +01:00

10 lines
246 B
Bash
Executable File

#!/bin/sh
secret=$(uci get gluon_mesh_vpn_wireguard.mesh_vpn.secret)
if [[ "$secret" = "generate" ]]; then
secret="$(wg genkey)"
uci set gluon_mesh_vpn_wireguard.mesh_vpn.secret="$secret"
uci commit gluon_mesh_vpn_wireguard
fi
echo "$secret"