Преглед изворни кода

Stabilze authentication

pull/2723/head
Julian-Samuel Gebühr пре 3 година
родитељ
комит
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 # The access token that the bot uses to communicate in Matrix chats
# This does not necessarily need to be a privileged (admin) access token. # This does not necessarily need to be a privileged (admin) access token.
matrix_bot_matrix_registration_bot_bot_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. # 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. # 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 }}`). You need to define a required configuration setting (`{{ item }}`).
when: "vars[item] == ''" when: "vars[item] == ''"
with_items: with_items:
- "matrix_bot_matrix_registration_bot_bot_access_token"
- "matrix_bot_matrix_registration_bot_api_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: bot:
server: {{ matrix_bot_matrix_registration_bot_bot_server|to_json }} server: {{ matrix_bot_matrix_registration_bot_bot_server|to_json }}
username: {{ matrix_bot_matrix_registration_bot_matrix_user_id_localpart|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 }} 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:
# API endpoint of the registration tokens # API endpoint of the registration tokens
base_url: {{ matrix_bot_matrix_registration_bot_api_base_url|to_json }} base_url: {{ matrix_bot_matrix_registration_bot_api_base_url|to_json }}


Loading…
Откажи
Сачувај