From b8903d5caec05404977070bfdac2e5113bf189e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julian-Samuel=20Geb=C3=BChr?= Date: Wed, 20 Apr 2022 21:14:43 +0200 Subject: [PATCH] Rename vars to make usage clear --- .../defaults/main.yml | 15 +++++++++++---- .../tasks/validate_config.yml | 1 + .../templates/config/config.yml.j2 | 4 ++-- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/roles/matrix-bot-matrix-registration-bot/defaults/main.yml b/roles/matrix-bot-matrix-registration-bot/defaults/main.yml index b081a3266..40538478e 100644 --- a/roles/matrix-bot-matrix-registration-bot/defaults/main.yml +++ b/roles/matrix-bot-matrix-registration-bot/defaults/main.yml @@ -17,7 +17,17 @@ matrix_bot_matrix_registration_bot_data_path: "{{ matrix_bot_matrix_registration matrix_bot_matrix_registration_bot_bot_server: "https://{{ matrix_server_fqn_matrix }}" matrix_bot_matrix_registration_bot_api_base_url: "https://{{ matrix_server_fqn_matrix }}" -matrix_bot_matrix_registration_bot_matrix_admin_token: "{{ matrix_bot_matrix_registration_bot_api_token }}" + +# The access token that the bot uses to communicate in Matrix chats +# This does not necessarily need to be a privileged (admin) access token. +matrix_bot_matrix_registration_bot_bot_access_token: '' + +# The access token that the bot uses to call the Matrix API for creating registration tokens. +# This needs to be a privileged (admin) access token. +# By default, we assume `matrix_bot_matrix_registration_bot_bot_access_token` is such a privileged token and we use it as is. +# If necessary, you can define your own other access token here, which might even be for a different Matrix user. +matrix_bot_matrix_registration_bot_api_token: "{{ matrix_bot_matrix_registration_bot_bot_access_token }}" + matrix_bot_matrix_registration_bot_logging_level: info matrix_bot_matrix_registration_environment_variables_extension: '' @@ -36,7 +46,4 @@ matrix_bot_matrix_registration_bot_matrix_user_id_localpart: "bot.matrix-registr matrix_bot_matrix_registration_bot_matrix_user_id: '@{{ matrix_bot_matrix_registration_bot_matrix_user_id_localpart }}:{{ matrix_domain }}' -# The password that the bot uses to authenticate. -matrix_bot_matrix_registration_bot_matrix_user_password: '' - matrix_bot_matrix_registration_bot_matrix_homeserver_url: "{{ matrix_homeserver_container_url }}" diff --git a/roles/matrix-bot-matrix-registration-bot/tasks/validate_config.yml b/roles/matrix-bot-matrix-registration-bot/tasks/validate_config.yml index c649b1827..d5db028d7 100644 --- a/roles/matrix-bot-matrix-registration-bot/tasks/validate_config.yml +++ b/roles/matrix-bot-matrix-registration-bot/tasks/validate_config.yml @@ -6,4 +6,5 @@ You need to define a required configuration setting (`{{ item }}`). when: "vars[item] == ''" with_items: + - "matrix_bot_matrix_registration_bot_bot_access_token" - "matrix_bot_matrix_registration_bot_api_token" diff --git a/roles/matrix-bot-matrix-registration-bot/templates/config/config.yml.j2 b/roles/matrix-bot-matrix-registration-bot/templates/config/config.yml.j2 index 79e1a73ce..66fa77710 100644 --- a/roles/matrix-bot-matrix-registration-bot/templates/config/config.yml.j2 +++ b/roles/matrix-bot-matrix-registration-bot/templates/config/config.yml.j2 @@ -1,12 +1,12 @@ bot: server: "{{ matrix_bot_matrix_registration_bot_bot_server }}" username: "{{ matrix_bot_matrix_registration_bot_matrix_user_id_localpart }}" - access_token: "{{ matrix_bot_matrix_registration_bot_api_token }}" + access_token: "{{ matrix_bot_matrix_registration_bot_bot_access_token }}" api: # API endpoint of the registration tokens base_url: '{{ matrix_bot_matrix_registration_bot_api_base_url }}' # Access token of an administrator on the server - token: "{{ matrix_bot_matrix_registration_bot_matrix_admin_token }}" + token: "{{ matrix_bot_matrix_registration_bot_api_token }}" logging: level: "{{ matrix_bot_matrix_registration_bot_logging_level }}"