feat: add optional config path argument to script

Introduced a `--config_path` parameter to allow specifying a custom path for the Wireguard configuration file. Defaults to `/etc/wireguard/{interface}.conf` if not provided. This enhances flexibility for different deployment environments and use cases.
This commit is contained in:
Kumi 2024-07-18 18:37:56 +02:00
parent 5bfd82aa6b
commit b60efb3f96
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -41,6 +41,7 @@ def main():
parser.add_argument("--location", type=str, required=True, help="Server location")
parser.add_argument("--server_type", type=str, required=True, help="Server type")
parser.add_argument("--interface", type=str, required=True, help="Wireguard interface (e.g., wg0)")
parser.add_argument("--config_path", type=str, help="Path to the Wireguard configuration file")
args = parser.parse_args()
@ -48,7 +49,7 @@ def main():
location = args.location
server_type = args.server_type
interface = args.interface
config_path = f"/etc/wireguard/{interface}.conf"
config_path = args.config_path or f"/etc/wireguard/{interface}.conf"
# Step 1: Execute the existing script to set up the remote VPN server
new_peer_section = execute_script(provider, location, server_type)