diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index dc96c2099..dcc06d8d7 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -122,6 +122,8 @@ matrix_mautrix_telegram_systemd_required_services_list: | matrix_mautrix_telegram_public_endpoint: "/{{ matrix_synapse_macaroon_secret_key | password_hash('sha512', 'telegram') | to_uuid }}" +matrix_mautrix_telegram_container_http_host_bind_port: "{{ '' if matrix_nginx_proxy_enabled else '127.0.0.1:9006' }}" + ###################################################################### # # /matrix-bridge-mautrix-telegram diff --git a/roles/matrix-bridge-mautrix-telegram/defaults/main.yml b/roles/matrix-bridge-mautrix-telegram/defaults/main.yml index 9e5ede91f..c0f3b0a0f 100644 --- a/roles/matrix-bridge-mautrix-telegram/defaults/main.yml +++ b/roles/matrix-bridge-mautrix-telegram/defaults/main.yml @@ -21,8 +21,10 @@ matrix_mautrix_telegram_homeserver_domain: '{{ matrix_domain }}' matrix_mautrix_telegram_appservice_address: 'http://matrix-mautrix-telegram:8080' matrix_mautrix_telegram_appservice_public_external: 'https://{{ matrix_server_fqn_matrix }}{{ matrix_mautrix_telegram_public_endpoint }}' -# Set this to a port number to expose on the host when not using matrix-nginx-proxy -matrix_mautrix_telegram_container_exposed_port_number: ~ +# Controls whether the matrix-telegram container exposes its HTTP port (tcp/8080 in the container). +# +# Takes an ":" or "" value (e.g. "127.0.0.1:9006"), or empty string to not expose. +matrix_mautrix_telegram_container_http_host_bind_port: '' # A list of extra arguments to pass to the container matrix_mautrix_telegram_container_extra_arguments: [] diff --git a/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml b/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml index 59b95550e..3b65a33dc 100644 --- a/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml +++ b/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml @@ -112,7 +112,7 @@ proxy_pass http://$backend; {% else %} {# Generic configuration for use outside of our container setup #} - proxy_pass http://127.0.0.1:8080; + proxy_pass http://127.0.0.1:9006; {% endif %} } diff --git a/roles/matrix-bridge-mautrix-telegram/tasks/validate_config.yml b/roles/matrix-bridge-mautrix-telegram/tasks/validate_config.yml index fac59c9ff..d30be92e2 100644 --- a/roles/matrix-bridge-mautrix-telegram/tasks/validate_config.yml +++ b/roles/matrix-bridge-mautrix-telegram/tasks/validate_config.yml @@ -9,3 +9,12 @@ - "matrix_mautrix_telegram_api_id" - "matrix_mautrix_telegram_api_hash" - "matrix_mautrix_telegram_public_endpoint" + +- name: (Deprecation) Catch and report renamed Telegram variables + fail: + msg: >- + Your configuration contains a variable, which now has a different name. + Please change your configuration to rename the variable (`{{ item.old }}` -> `{{ item.new }}`). + when: "item.old in vars" + with_items: + - {'old': 'matrix_mautrix_telegram_container_exposed_port_number', 'new': ''} diff --git a/roles/matrix-bridge-mautrix-telegram/templates/systemd/matrix-mautrix-telegram.service.j2 b/roles/matrix-bridge-mautrix-telegram/templates/systemd/matrix-mautrix-telegram.service.j2 index 18d8a7ede..c47ad8666 100644 --- a/roles/matrix-bridge-mautrix-telegram/templates/systemd/matrix-mautrix-telegram.service.j2 +++ b/roles/matrix-bridge-mautrix-telegram/templates/systemd/matrix-mautrix-telegram.service.j2 @@ -26,8 +26,8 @@ ExecStart=/usr/bin/docker run --rm --name matrix-mautrix-telegram \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --cap-drop=ALL \ --network={{ matrix_docker_network }} \ - {% if matrix_mautrix_telegram_container_exposed_port_number is not none %} - -p 127.0.0.1:{{ matrix_mautrix_telegram_container_exposed_port_number }}:8080 \ + {% if matrix_mautrix_telegram_container_http_host_bind_port %} + -p {{ matrix_mautrix_telegram_container_http_host_bind_port }}:8080 \ {% endif %} -v {{ matrix_mautrix_telegram_base_path }}:/data:z \ {% for arg in matrix_mautrix_telegram_container_extra_arguments %}