From 792bed3f5ab777c7d1ffc43b7f23a91add5897db Mon Sep 17 00:00:00 2001 From: anadahz Date: Fri, 23 Nov 2018 00:42:54 +0000 Subject: [PATCH] Fix add/config based on comments by @spantaleev --- examples/host-vars.yml | 13 ------------- roles/matrix-server/defaults/main.yml | 11 +++++++++++ .../templates/riot-web/config.json.j2 | 18 +++--------------- .../templates/synapse/homeserver.yaml.j2 | 18 ++++-------------- 4 files changed, 18 insertions(+), 42 deletions(-) diff --git a/examples/host-vars.yml b/examples/host-vars.yml index 14f4b9a1..80a4c13e 100644 --- a/examples/host-vars.yml +++ b/examples/host-vars.yml @@ -25,16 +25,3 @@ matrix_coturn_turn_static_auth_secret: "" # A secret used to protect access keys issued by the server. # You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`). matrix_synapse_macaroon_secret_key: "" - -# Set autojoin room(s) -# Users who register on this homeserver will automatically be joined to these rooms -matrix_autojoin_rooms: ['#room:server.tld'] - -# Enable registrations, disabled by default. -matrix_enable_reg: true - -# Disable Riot welcome bot, default enabled -riot_welcome_bot: false - -# Riot public room directory server -riot_roomdir_servers: ['server.tld'] diff --git a/roles/matrix-server/defaults/main.yml b/roles/matrix-server/defaults/main.yml index fef3b0e0..220d997e 100644 --- a/roles/matrix-server/defaults/main.yml +++ b/roles/matrix-server/defaults/main.yml @@ -84,6 +84,10 @@ matrix_synapse_report_stats: false # disabling this will decrease server load significantly. matrix_synapse_use_presence: true +# Set autojoin room(s) +# Users who register on this homeserver will automatically be joined to these rooms +matrix_synapse_autojoin_rooms: [] + # Controls password-peppering for Matrix Synapse. Not to be changed after initial setup. matrix_synapse_password_config_pepper: "" @@ -142,6 +146,9 @@ matrix_synapse_ext_password_provider_shared_secret_auth_download_url: "https://r matrix_synapse_ext_password_provider_shared_secret_auth_shared_secret: "" +# Enable registration to new users. +matrix_homeserver_enable_registration: false + # The defaults below cause a postgres server to be configured (running within a container). # Using an external server is possible by tweaking all of the parameters below. matrix_postgres_use_external: false @@ -262,6 +269,10 @@ matrix_riot_web_integrations_ui_url: "https://scalar.vector.im/" matrix_riot_web_integrations_rest_url: "https://scalar.vector.im/api" matrix_riot_web_integrations_widgets_urls: "https://scalar.vector.im/api" matrix_riot_web_integrations_jitsi_widget_url: "https://scalar.vector.im/api/widgets/jitsi.html" +# Riot public room directory server(s) +matrix_riot_web_roomdir_servers: ['matrix.org'] +# Uncomment to enable default riot user bot +matrix_riot_web_welcome_user_id: "@riot-bot:matrix.org" diff --git a/roles/matrix-server/templates/riot-web/config.json.j2 b/roles/matrix-server/templates/riot-web/config.json.j2 index 52004cbc..7218271f 100644 --- a/roles/matrix-server/templates/riot-web/config.json.j2 +++ b/roles/matrix-server/templates/riot-web/config.json.j2 @@ -10,23 +10,11 @@ "integrations_jitsi_widget_url": "{{ matrix_riot_web_integrations_jitsi_widget_url }}", "bug_report_endpoint_url": "https://riot.im/bugreports/submit", "enableLabs": true, -{% if riot_roomdir_servers is defined %} -{% for server in riot_roomdir_servers %} "roomDirectory": { - "servers": [ - "{{ server }}" - ] + "servers": {{ matrix_riot_web_roomdir_servers|to_nice_yaml }} +{% if matrix_riot_web_welcome_user_id %} }, -{% endfor %} -{% else %} - "roomDirectory": { - "servers": [ - "matrix.org" - ] -{% endif %} -{% if riot_welcome_bot|default(true)|bool %} - }, - "welcomeUserId": "@riot-bot:matrix.org" + "welcomeUserId": "{{ matrix_riot_web_welcome_user_id }}" {% else %} } {% endif %} diff --git a/roles/matrix-server/templates/synapse/homeserver.yaml.j2 b/roles/matrix-server/templates/synapse/homeserver.yaml.j2 index ceefad03..49fa2c96 100644 --- a/roles/matrix-server/templates/synapse/homeserver.yaml.j2 +++ b/roles/matrix-server/templates/synapse/homeserver.yaml.j2 @@ -432,11 +432,7 @@ turn_allow_guests: False ## Registration ## # Enable registration for new users. -{% if matrix_enable_reg|default(false)|bool %} -enable_registration: True -{% else %} -enable_registration: False -{% endif %} +enable_registration: {{ matrix_homeserver_enable_registration|capitalize }} # The user must provide all of the below types of 3PID when registering. # @@ -478,17 +474,11 @@ trusted_third_party_id_servers: - {{ server }} {% endfor %} -# Users who register on this homeserver will automatically be joined -# to these rooms -{% if matrix_autojoin_rooms is defined %} -{% for room in matrix_autojoin_rooms %} -auto_join_rooms: - - "{{ room }}" -{% endfor %} -{% else %} +# Users who register on this homeserver will automatically be joined to these rooms +{% if matrix_synapse_autojoin_rooms|length >0 %} #auto_join_rooms: # - "#example:example.com" - +auto_join_rooms: {{ matrix_synapse_autojoin_rooms|to_yaml }} {% endif %} ## Metrics ###