mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-06-17 11:10:23 +00:00
matrixsynapse: Add post install YAML edits
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
parent
f550c7f68a
commit
044df8352d
@ -21,7 +21,8 @@
|
||||
Configuration helper for Matrix-Synapse server.
|
||||
"""
|
||||
import argparse
|
||||
import subprocess
|
||||
|
||||
from ruamel.yaml import round_trip_dump, round_trip_load
|
||||
|
||||
from plinth import action_utils
|
||||
|
||||
@ -31,10 +32,9 @@ def parse_arguments():
|
||||
parser = argparse.ArgumentParser()
|
||||
subparsers = parser.add_subparsers(dest='subcommand', help='Sub command')
|
||||
|
||||
# Preseed debconf values before packages are installed.
|
||||
pre_install = subparsers.add_parser(
|
||||
'pre-install',
|
||||
help='Preseed debconf values before packages are installed.')
|
||||
post_install = subparsers.add_parser(
|
||||
'post-install',
|
||||
help="Perform post install steps")
|
||||
|
||||
subparsers.add_parser('enable', help='Enable matrix-synapse service')
|
||||
subparsers.add_parser('disable', help='Disable matrix-synapse service')
|
||||
@ -46,11 +46,19 @@ def parse_arguments():
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def subcommand_pre_install(_):
|
||||
subprocess.check_output(
|
||||
['debconf-set-selections'],
|
||||
input=b'matrix-synapse matrix-synapse/report-stats boolean ' +
|
||||
b'false')
|
||||
def subcommand_post_install(_):
|
||||
file_path = "/etc/matrix-synapse/homeserver.yaml"
|
||||
|
||||
with open(file_path) as config_file:
|
||||
config = round_trip_load(config_file)
|
||||
|
||||
config["no_tls"] = True
|
||||
config["listeners"][1]["bind_address"] = "127.0.0.1"
|
||||
config["max_upload_size"] = "100M"
|
||||
config["enable_registration"] = True
|
||||
|
||||
with open(file_path, "w") as config_file:
|
||||
round_trip_dump(config, config_file)
|
||||
|
||||
|
||||
def subcommand_setup(arguments):
|
||||
|
||||
@ -80,8 +80,6 @@ def init():
|
||||
|
||||
def setup(helper, old_version=None):
|
||||
"""Install and configure the module."""
|
||||
helper.call('pre', actions.superuser_run, 'matrixsynapse',
|
||||
['pre-install'])
|
||||
helper.install(managed_packages)
|
||||
global service
|
||||
if service is None:
|
||||
@ -90,6 +88,8 @@ def setup(helper, old_version=None):
|
||||
ports=['matrix-synapse'],
|
||||
is_external=True, is_enabled=is_enabled, enable=enable,
|
||||
disable=disable)
|
||||
helper.call('post', actions.superuser_run, 'matrixsynapse',
|
||||
['post-install'])
|
||||
helper.call('post', service.notify_enabled, None, True)
|
||||
helper.call('post', add_shortcut)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user