🔧(settings) rename matrix bot token variable

rename "tchap access token" to "matrix bot access token" to
fit general uses
This commit is contained in:
Marie PUPO JEAMMET
2025-06-26 16:20:05 +02:00
committed by Marie
parent 709628a26a
commit 5327baacbd
4 changed files with 6 additions and 8 deletions

View File

@@ -131,7 +131,7 @@ def test_matrix_webhook__invite_user_to_room_success(caplog):
@responses.activate @responses.activate
@override_settings(TCHAP_ACCESS_TOKEN="TCHAP_TOKEN") @override_settings(MATRIX_BOT_ACCESS_TOKEN="TCHAP_TOKEN")
def test_matrix_webhook__override_secret_for_tchap(): def test_matrix_webhook__override_secret_for_tchap():
"""The user passed to the function should get invited.""" """The user passed to the function should get invited."""
user = factories.UserFactory() user = factories.UserFactory()

View File

@@ -29,13 +29,11 @@ session.mount("https://", adapter)
class MatrixAPIClient: class MatrixAPIClient:
"""A client to interact with Matrix API""" """A client to interact with Matrix API"""
secret = settings.TCHAP_ACCESS_TOKEN
def get_headers(self, webhook): def get_headers(self, webhook):
"""Build header dict from webhook object.""" """Build header dict from webhook object."""
headers = {"Content-Type": "application/json"} headers = {"Content-Type": "application/json"}
if "tchap.gouv.fr" in webhook.url: if "tchap.gouv.fr" in webhook.url:
token = settings.TCHAP_ACCESS_TOKEN token = settings.MATRIX_BOT_ACCESS_TOKEN
elif webhook.secret: elif webhook.secret:
token = webhook.secret token = webhook.secret
else: else:

View File

@@ -601,9 +601,9 @@ class Base(Configuration):
environ_name="DNS_PROVISIONING_API_CREDENTIALS", environ_name="DNS_PROVISIONING_API_CREDENTIALS",
environ_prefix=None, environ_prefix=None,
) )
TCHAP_ACCESS_TOKEN = values.Value( MATRIX_BOT_ACCESS_TOKEN = values.Value(
default=None, default=None,
environ_name="TCHAP_ACCESS_TOKEN", environ_name="MATRIX_BOT_ACCESS_TOKEN",
environ_prefix=None, environ_prefix=None,
) )

View File

@@ -73,7 +73,7 @@ backend:
secretKeyRef: secretKeyRef:
name: backend name: backend
key: MAIL_PROVISIONING_API_CREDENTIALS key: MAIL_PROVISIONING_API_CREDENTIALS
TCHAP_ACCESS_TOKEN: service_account_key MATRIX_BOT_ACCESS_TOKEN: service_account_key
command: command:
- "gunicorn" - "gunicorn"
- "-c" - "-c"