🔧(settings) rename matrix bot token variable
rename "tchap access token" to "matrix bot access token" to fit general uses
This commit is contained in:
committed by
Marie
parent
709628a26a
commit
5327baacbd
@@ -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()
|
||||||
|
|||||||
@@ -28,14 +28,12 @@ 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:
|
||||||
|
|||||||
@@ -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,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -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"
|
||||||
|
|||||||
Reference in New Issue
Block a user