Modifying functions

This commit is contained in:
chabisik 2022-12-22 23:24:16 +01:00
parent 6074076841
commit b1c4f64af5

View file

@ -12,7 +12,10 @@ import urllib.parse
parser = argparse.ArgumentParser(description="To set up database location and intial values by system administrator")
parser.add_argument("--setDatabase", type=int, default=0, help="Wether system administrator want to set up database (1) or not (0)")
parser.add_argument("--launch", type=int, default=1, help="Wether to launch the application (1) or not (0)")
set_database = parser.parse_args().setDatabase
launch_app = parser.parse_args().launch
app = flask.Flask(import_name=__name__, template_folder=".")
actuator_locker = threading.Lock()
@ -139,6 +142,8 @@ def database_setter():
passw = str(input("Enter the password: "))
subprocess.run("echo \"INTERNET_PWD='"+passw+"'\" >> "+database_location+"/config.py", shell=True, executable="/bin/bash")
def users_manager(lck):
pass
def opener(lck):
with lck:
@ -250,8 +255,9 @@ if __name__=="__main__":
exit(-1)
#---import config file---
import config
remote_handler_thread = threading.Thread(target=remote_handler, args=(actuator_locker,))
remote_handler_thread.start()
localtunnel_thread = threading.Thread(target=localtunnel_launcher)
localtunnel_thread.start()
app.run(host="0.0.0.0", port=8000)
if launch_app==1:
remote_handler_thread = threading.Thread(target=remote_handler, args=(actuator_locker,))
remote_handler_thread.start()
localtunnel_thread = threading.Thread(target=localtunnel_launcher)
localtunnel_thread.start()
app.run(host="0.0.0.0", port=8000)