dev env
This commit is contained in:
parent
6185a59de9
commit
9e16843a29
8 changed files with 178 additions and 123 deletions
29
dev.sh
Executable file
29
dev.sh
Executable file
|
|
@ -0,0 +1,29 @@
|
|||
#!/bin/bash
|
||||
|
||||
exec 3< <(stripe listen --events checkout.session.completed,checkout.session.async_payment_succeeded --forward-to localhost:8000/webhook 2>&1)
|
||||
CHILD_PID=$!
|
||||
trap "kill -TERM $CHILD_PID 2>/dev/null; exec 3<&-" EXIT
|
||||
|
||||
if [ -f .env ]; then
|
||||
export $(cat .env | xargs)
|
||||
fi
|
||||
export DEV_ENV="TRUE"
|
||||
export WEBHOOK_SECRET=""
|
||||
|
||||
while IFS= read -r line <&3; do
|
||||
matched_value=$(echo "$line" | grep -oP 'whsec_[a-zA-Z0-9]+')
|
||||
if [ -n "$matched_value" ]; then
|
||||
WEBHOOK_SECRET=$matched_value
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
exec 3<&-
|
||||
|
||||
if [ -z "$WEBHOOK_SECRET" ]; then
|
||||
echo "Error: can't get the webhook secret"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
go tool templ generate
|
||||
go run .
|
||||
Loading…
Add table
Add a link
Reference in a new issue