exit on not using run.sh script

This commit is contained in:
hyperbel 2023-05-19 15:39:15 +02:00
parent c0a81f8af7
commit 0a4234c2ee
2 changed files with 11 additions and 0 deletions

View File

@ -1,10 +1,17 @@
""" used for argument parsing and starting the server """
import os
import argparse
from server import server
from database import mate_erstellen
def main():
""" entrypoint to program """
# check if run with run.sh
if os.getenv('RUN_WITH_SH') != '1':
print("Bitte starte das Programm mit dem Startskript `run.sh`!")
exit(1)
parser = argparse.ArgumentParser(
prog = 'Party Controller',
description = 'Manage LAN Parties',
@ -29,5 +36,6 @@ def main():
else:
parser.print_help()
if __name__ == "__main__":
exit(main())

3
run.sh
View File

@ -10,6 +10,9 @@ fi
if [ ! -e ./Config/log/chat.log ]; then
touch ./Config/log/chat.log
fi
export RUN_WITH_SH=1
export FLASK_APP=main.py