This commit is contained in:
parent
7751b0d0f8
commit
444c853f54
|
@ -14,7 +14,7 @@ from orm.author import Author
|
|||
from resolvers.stat import get_with_stat
|
||||
from services.db import local_session
|
||||
from services.schema import request_graphql_data
|
||||
from settings import ADMIN_SECRET
|
||||
from settings import ADMIN_SECRET, WEBHOOK_SECRET
|
||||
|
||||
|
||||
async def create_webhook_endpoint():
|
||||
|
@ -33,14 +33,19 @@ async def create_webhook_endpoint():
|
|||
"event_name": "user.login",
|
||||
"endpoint": "https://core.dscrs.site/new-author",
|
||||
"enabled": True,
|
||||
"headers": {
|
||||
"Authorization": WEBHOOK_SECRET
|
||||
},
|
||||
}
|
||||
}
|
||||
gql = {
|
||||
"query": f"query {operation}($params: AddWebhookRequest!) {{"
|
||||
"query": f"query {operation}($params: AddWebhookRequest!)"
|
||||
+ "{"
|
||||
+ f"{query_name}(params: $params) {{ message }} "
|
||||
+ "}",
|
||||
"variables": variables,
|
||||
"operationName": operation,
|
||||
|
||||
}
|
||||
result = await request_graphql_data(gql, headers=headers)
|
||||
logger.info(result)
|
||||
|
|
|
@ -15,3 +15,4 @@ DEV_SERVER_PID_FILE_NAME = "dev-server.pid"
|
|||
MODE = "development" if "dev" in sys.argv else "production"
|
||||
|
||||
ADMIN_SECRET = environ.get("AUTH_SECRET") or "nothing"
|
||||
WEBHOOK_SECRET = environ.get("WEBHOOK_SECRET") or "nothing-else"
|
Loading…
Reference in New Issue
Block a user