Skip to content

Commit

Permalink
Merge pull request #3142 from jamshale/patch/0.11.x-pr3081
Browse files Browse the repository at this point in the history
[ PATCH ] 0.11.x with PR 3081 terse webhooks
  • Loading branch information
swcurran authored Aug 1, 2024
2 parents bec202a + c804f75 commit 906a434
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class V20CredExRecordWebhook:
"credential_definition_id",
"schema_id",
"credential_id",
"by_format",
"trace",
"public_did",
"cred_id_stored",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ async def emit_event(self, session: ProfileSession, payload: Any = None):
else:
topic = f"{self.EVENT_NAMESPACE}::{self.RECORD_TOPIC}"

if session.profile.settings.get("debug.webhooks"):
if not payload:
payload = self.serialize()
# serialize payload before checking for webhook contents
if not payload:
payload = self.serialize()
else:
payload = V20CredExRecordWebhook(**self.__dict__)
payload = V20CredExRecordWebhook(**payload)
payload = payload.__dict__

await session.profile.notify(topic, payload)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class V20PresExRecordWebhook:
"thread_id",
"state",
"trace",
"by_format",
"verified",
"verified_msgs",
"created_at",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,11 +197,11 @@ async def emit_event(self, session: ProfileSession, payload: Any = None):
else:
topic = f"{self.EVENT_NAMESPACE}::{self.RECORD_TOPIC}"

if session.profile.settings.get("debug.webhooks"):
if not payload:
payload = self.serialize()
else:
payload = V20PresExRecordWebhook(**self.__dict__)
# serialize payload before checking for webhook contents
if not payload:
payload = self.serialize()
if not session.profile.settings.get("debug.webhooks"):
payload = V20PresExRecordWebhook(**payload)
payload = payload.__dict__

await session.profile.notify(topic, payload)
Expand Down
3 changes: 3 additions & 0 deletions demo/run_bdd
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ fi
if ! [ -z "$WEBHOOK_TARGET" ]; then
DOCKER_ENV="${DOCKER_ENV} -e WEBHOOK_TARGET=${WEBHOOK_TARGET}"
fi
if ! [ -z "$ACAPY_DEBUG_WEBHOOKS" ]; then
DOCKER_ENV="${DOCKER_ENV} -e ACAPY_DEBUG_WEBHOOKS=${ACAPY_DEBUG_WEBHOOKS}"
fi
# if $TAILS_NETWORK is specified it will override any previously specified $DOCKER_NET
if ! [ -z "$TAILS_NETWORK" ]; then
DOCKER_NET="${TAILS_NETWORK}"
Expand Down
3 changes: 3 additions & 0 deletions demo/run_demo
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@ fi
if ! [ -z "$WEBHOOK_TARGET" ]; then
DOCKER_ENV="${DOCKER_ENV} -e WEBHOOK_TARGET=${WEBHOOK_TARGET}"
fi
if ! [ -z "$ACAPY_DEBUG_WEBHOOKS" ]; then
DOCKER_ENV="${DOCKER_ENV} -e ACAPY_DEBUG_WEBHOOKS=${ACAPY_DEBUG_WEBHOOKS}"
fi
# if $TAILS_NETWORK is specified it will override any previously specified $DOCKER_NET
if ! [ -z "$TAILS_NETWORK" ]; then
DOCKER_NET="${TAILS_NETWORK}"
Expand Down
4 changes: 3 additions & 1 deletion demo/runners/support/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
TRACE_ENABLED = os.getenv("TRACE_ENABLED")

WEBHOOK_TARGET = os.getenv("WEBHOOK_TARGET")
ACAPY_DEBUG_WEBHOOKS = os.getenv("ACAPY_DEBUG_WEBHOOKS")

AGENT_ENDPOINT = os.getenv("AGENT_ENDPOINT")

Expand Down Expand Up @@ -417,7 +418,8 @@ def get_agent_args(self):
# turn on notifications if revocation is enabled
result.append("--notify-revocation")
# enable extended webhooks
result.append("--debug-webhooks")
if ACAPY_DEBUG_WEBHOOKS:
result.append("--debug-webhooks")
# always enable notification webhooks
result.append("--monitor-revocation-notification")

Expand Down
1 change: 0 additions & 1 deletion docker/Dockerfile.demo
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ FROM ${from_image}
ENV ENABLE_PTVSD 0
ENV ENABLE_PYDEVD_PYCHARM 0
ENV PYDEVD_PYCHARM_HOST "host.docker.internal"
ENV ACAPY_DEBUG_WEBHOOKS 1

RUN mkdir -p bin && curl -L -o bin/jq \
https://github.com/stedolan/jq/releases/download/jq-1.6/jq-linux64 && \
Expand Down

0 comments on commit 906a434

Please sign in to comment.