Просмотр исходного кода

Stabilze authentication

pull/2723/head
Julian-Samuel Gebühr 3 лет назад
Родитель
Сommit
f901c3049e
3 измененных файлов: 14 добавлений и 1 удалений
  1. +2
    -0
      roles/custom/matrix-bot-matrix-registration-bot/defaults/main.yml
  2. +6
    -1
      roles/custom/matrix-bot-matrix-registration-bot/tasks/validate_config.yml
  3. +6
    -0
      roles/custom/matrix-bot-matrix-registration-bot/templates/config/config.yml.j2

+ 2
- 0
roles/custom/matrix-bot-matrix-registration-bot/defaults/main.yml Просмотреть файл

@@ -24,6 +24,8 @@ matrix_bot_matrix_registration_bot_api_base_url: "https://{{ matrix_server_fqn_m
# 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: ''
# Instead also a password can be used
matrix_bot_matrix_registration_bot_bot_password: ''

# 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.


+ 6
- 1
roles/custom/matrix-bot-matrix-registration-bot/tasks/validate_config.yml Просмотреть файл

@@ -6,5 +6,10 @@
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"

- name: Fail if now bot secret is defined
ansible.builtin.fail:
msg: >-
You need to define the bot secret to login.
when: "matrix_bot_matrix_registration_bot_bot_password == '' and matrix_bot_matrix_registration_bot_api_token ==''"

+ 6
- 0
roles/custom/matrix-bot-matrix-registration-bot/templates/config/config.yml.j2 Просмотреть файл

@@ -1,7 +1,13 @@
bot:
server: {{ matrix_bot_matrix_registration_bot_bot_server|to_json }}
username: {{ matrix_bot_matrix_registration_bot_matrix_user_id_localpart|to_json }}
{% if matrix_bot_matrix_registration_bot_bot_access_token | length > 0 %}
access_token: {{ matrix_bot_matrix_registration_bot_bot_access_token|to_json }}
{% endif %}
{% if matrix_bot_matrix_registration_bot_bot_password | length > 0 %}
password: {{ matrix_bot_matrix_registration_bot_bot_password|to_json }}
{% endif %}

api:
# API endpoint of the registration tokens
base_url: {{ matrix_bot_matrix_registration_bot_api_base_url|to_json }}


Загрузка…
Отмена
Сохранить