You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
1.0 KiB

2 years ago
import sys, main, os, uservar
key = os.environ.get('MATRIX_KEY')
def checks():
if uservar.ip is None:
print("ERROR: IP variable empty")
sys.exit()
if uservar.heisenberg_bridge == True and not uservar.heisenbridge_owner:
print("please fill in a matrix user")
sys.exit()
if uservar.appservice_discord_bridge and not uservar.appservice_discord_brige_client_id or not uservar.appservice_discord_bridge_token:
print("ERROR: fill out all appservice variables")
sys.exit()
if key is None and uservar.add_key == False:
homeserver_key = os.popen("pwgen -s 64 1").read()
homeserver_key = main.func(homeserver_key)
print("if ist durch")
with open('/home/{}/.bashrc'.format(main.user), 'a') as f:
f.write("export MATRIX_KEY={}".format(homeserver_key))
f.close()
elif key is not None and uservar.add_key == False:
homeserver_key = key
elif uservar.add_key == True:
homeserver_key = uservar.homeserver_key