Fix the PR from earlier.
This commit is contained in:
parent
32cad6847c
commit
9c87b660b8
1 changed files with 8 additions and 12 deletions
20
server.py
20
server.py
|
@ -18,28 +18,24 @@ from modules import render
|
|||
CSS = "https://zortazert.codeberg.page/style/styles.css"
|
||||
|
||||
try:
|
||||
if os.path.exists("config.json"):
|
||||
with open("config.json","r") as f:
|
||||
srvConfig = json.load(f)
|
||||
ADDRESS = srvConfig["address"]
|
||||
PORT = srvConfig["port"]
|
||||
CSS = srvConfig["css"]
|
||||
|
||||
with open("config.json","r") as f:
|
||||
srvConfig = json.load(f)
|
||||
ADDRESS = srvConfig["address"]
|
||||
PORT = srvConfig["port"]
|
||||
CSS = srvConfig["css"]
|
||||
except:
|
||||
newConfig = open("config.json", "w")
|
||||
newConfig.write("""{
|
||||
"INFO" : "You would be better off setting address to the full URL of the FreeCompetitors instance.",
|
||||
"address" : "/",
|
||||
"port" : "8080",
|
||||
"port" : 8080,
|
||||
"css" : "https://zortazert.codeberg.page/style/styles.css"
|
||||
}""")
|
||||
newConfig.close
|
||||
print("Please edit the configuration file \"config.json\".")
|
||||
exit()
|
||||
try:
|
||||
PORT = int(PORT)
|
||||
except:
|
||||
print("Port should be a number")
|
||||
exit()
|
||||
|
||||
|
||||
# Who fucking made this http.server so I need to use classes?
|
||||
# I fucking hate who ever thought that it was a good idea...
|
||||
|
|
Loading…
Reference in a new issue