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.
69 lines
3.1 KiB
69 lines
3.1 KiB
import main, checks, uservar, setup
|
|
|
|
def setup():
|
|
with open('{}/uservar.yml'.format(main.yml_path), 'r+') as f:
|
|
lines = [
|
|
'matrix_domain: {}\n'.format(uservar.domain),
|
|
'matrix_homeserver_implementation: synapse\n',
|
|
"matrix_homeserver_generic_secret_key: '{}' \n".format(checks.homeserver_key),
|
|
'matrix_ssl_lets_encrypt_support_email: "{}" \n'.format(uservar.email),
|
|
"devture_postgres_connection_password: '{}' \n".format(uservar.postgres_password),
|
|
'matrix_well_known_matrix_support_enabled: true\n',
|
|
'matrix_nginx_proxy_base_domain_serving_enabled: true\n'
|
|
]
|
|
content = f.read()
|
|
# if "matrix_homeserver_generic_secret_key:" not in content:
|
|
# lines[0] = "matrix_homeserver_generic_secret_key: '{}' \n".format(homeserver_key)
|
|
for i, line in enumerate(lines):
|
|
get_line = line.split(": ")[0].strip()
|
|
get_var = line.split(": ")[1].strip()
|
|
print(get_var)
|
|
print(line)
|
|
if get_line not in content:
|
|
print("get_line wurde aufgerufen")
|
|
lines[i] = "{}: {}\n".format(get_line, get_var)
|
|
elif get_var not in content:
|
|
print(i)
|
|
lines[i] = "{}: {}\n".format(get_line, get_var)
|
|
f.seek(0)
|
|
f.truncate()
|
|
f.writelines(lines)
|
|
f.close()
|
|
|
|
if uservar.mautrix_discord_bridge:
|
|
with open('{}/foo.yml'.format(main.yml_path), 'a') as f:
|
|
f.write("matrix_mautrix_discord_enabled: true\n")
|
|
f.close()
|
|
if uservar.mautrix_signal_bridge:
|
|
with open('{}/foo.yml'.format(main.yml_path), 'a') as f:
|
|
f.write("matrix_mautrix_signal_enabled: true\n")
|
|
f.close()
|
|
if uservar.heisenberg_bridge:
|
|
with open('{}/foo.yml'.format(main.yml_path), 'a') as f:
|
|
heisenbridge = [
|
|
"matrix_heisenbridge_enabled: true\n",
|
|
'matrix_heisenbridge_owner: "{}"\n'.format(uservar.heisenbridge_owner),
|
|
"matrix_heisenbridge_identd_enabled: true\n"
|
|
]
|
|
f.writelines(heisenbridge)
|
|
f.close()
|
|
if uservar.appservice_discord_bridge:
|
|
with open('{}/foo.yml'.format(main.yml_path), 'a') as f:
|
|
appservice = [
|
|
"matrix_appservice_discord_enabled: true\n",
|
|
"matrix_appservice_discord_bridge_enableSelfServiceBridging: true\n",
|
|
'matrix_appservice_discord_client_id: "{}"\n'.format(uservar.appservice_discord_brige_client_id),
|
|
'matrix_appservice_discord_bot_token: "{}"\n'.format(uservar.appservice_discord_bridge_token)
|
|
]
|
|
f.writelines(appservice)
|
|
f.close()
|
|
|
|
if uservar.http_port is not None:
|
|
with open('{}/foo.yml'.format(main.yml_path), 'a') as f:
|
|
ports = [
|
|
"matrix_nginx_proxy_container_http_host_bind_port: '{}'\n".format(uservar.http_port),
|
|
"matrix_nginx_proxy_container_https_host_bind_port: '{}'\n".format(uservar.https_port)
|
|
]
|
|
f.writelines(ports)
|
|
f.close()
|