You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
421 B

from string import Template
import os
def gen_config(client, ip):
if "temp" not in os.listdir():
os.mkdir("temp")
text = ""
with open("input/config", "r") as input_file:
for line in input_file.readlines():
text+=line
config = Template(text)
with open(f"temp/{client}.ovpn", "w") as output_file:
output_file.write(config.substitute(ip=ip, client=client))