Add support for more flexible container port exposing

Fixes #171 (Github Issue).
This commit is contained in:
Slavi Pantaleev
2019-05-25 07:41:04 +09:00
parent 5bfd22d13b
commit ab59cc50bd
26 changed files with 197 additions and 66 deletions

View File

@ -11,8 +11,10 @@ matrix_appservice_discord_base_path: "{{ matrix_base_data_path }}/appservice-dis
matrix_appservice_discord_client_id: ''
matrix_appservice_discord_bot_token: ''
# Controls whether the Appservice Discord container exposes the Client/Server API port (tcp/9005).
matrix_appservice_discord_container_expose_client_server_api_port: false
# Controls whether the matrix-appservice-discord container exposes its HTTP port (tcp/9005 in the container).
#
# Takes an "<ip>:<port>" or "<port>" value (e.g. "127.0.0.1:9005"), or empty string to not expose.
matrix_appservice_discord_container_http_host_bind_port: ''
# A list of extra arguments to pass to the container
matrix_appservice_discord_container_extra_arguments: []

View File

@ -8,3 +8,12 @@
with_items:
- "matrix_appservice_discord_client_id"
- "matrix_appservice_discord_bot_token"
- name: (Deprecation) Catch and report renamed appservice-discord 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_appservice_discord_container_expose_client_server_api_port', 'new': '<superseded by matrix_appservice_discord_container_http_host_bind_port>'}

View File

@ -19,8 +19,8 @@ ExecStart=/usr/bin/docker run --rm --name matrix-appservice-discord \
--user={{ matrix_user_uid }}:{{ matrix_user_gid }} \
--cap-drop=ALL \
--network={{ matrix_docker_network }} \
{% if matrix_appservice_discord_container_expose_client_server_api_port %}
-p 127.0.0.1:9005:9005 \
{% if matrix_appservice_discord_container_http_host_bind_port %}
-p {{ matrix_appservice_discord_container_http_host_bind_port }}:9005 \
{% endif %}
-v {{ matrix_appservice_discord_base_path }}:/data \
{% for arg in matrix_appservice_discord_container_extra_arguments %}