Add 'scripts/setup-template.py'

pull/4/head
drunkendog 2022-09-23 21:41:25 +01:00
parent 61a653750f
commit e898c3fbe9
1 changed files with 17 additions and 0 deletions

17
scripts/setup-template.py Normal file
View File

@ -0,0 +1,17 @@
#IMPORT
import os, sys
#FILE_READ
with open("../nginx-site-template.conf", "r") as f:
template = f.read().replace("#serverNameVar", f"{sys.argv[1]}").replace("#http://127.0.0.1:8080/", f"#ip_address")
#FILE_WRITE
with open("/etc/nginx/sites-available/#service.conf", "w") as f:
f.write(template)
#GENERATE_NGINX
# depreceated, TODO: replace with os.subprocess
os.system("sh ../nginx-ensite.sh #service")
#START_CONTAINER
os.system("sh launch-docker.sh")