mirror of
https://github.com/Pagwin-Fedora/website.git
synced 2025-07-17 21:25:41 +00:00
20 lines
422 B
Python
Executable file
20 lines
422 B
Python
Executable file
#!/bin/env python3
|
|
|
|
import os
|
|
import re
|
|
|
|
var_name = "COMMENTS_BACKEND"
|
|
file_name = "nginx.conf"
|
|
back = os.environ.get(var_name)
|
|
buf = str()
|
|
with open(file_name+".template") as file:
|
|
buf = file.read()
|
|
|
|
if back == None:
|
|
buf = re.sub("###{---(.|\n)*###---}", "", buf)
|
|
else:
|
|
# ${{\s*$var_name\s*}}
|
|
buf = re.sub(rf"\${{{{\s*{var_name}\s*}}}}",back,buf)
|
|
|
|
with open(file_name, "w+") as file:
|
|
file.write(buf)
|