Browse Source

bugfix and documentation

pull/1/head
Matthew Raymer 1 year ago
parent
commit
b8b47caf55
  1. 25
      README.md
  2. 6
      app.py

25
README.md

@ -1,2 +1,27 @@
# py-push-server # py-push-server
## Docker Compose Setup
```
version: '3.1'
services:
endorser-push-server:
container_name: 'endorser-push-server'
image: endorser-push-server:1.0
build:
context: ./py-push-server
volumes:
- /docker-volumes/pwa-push-server/data:/app/instance/data
restart: always
networks:
- phoenix-network
networks:
phoenix-network:
external: true
```
ON first run you need to:
`docker network create phoenix-network`

6
app.py

@ -135,7 +135,7 @@ class WebPushService():
subscription_info=subscription_info, subscription_info=subscription_info,
data=json.dumps(message), data=json.dumps(message),
vapid_private_key=vapid_key.private_key, vapid_private_key=vapid_key.private_key,
vapid_claims={"sub": "mailto:admin@yourdomain.com"} vapid_claims={"sub": "mailto:matthew.raymer@gmail.com"}
) )
return True return True
@ -297,7 +297,7 @@ class WebPushService():
db.session.commit() db.session.commit()
# Introducing a delay (ensure that gateway endpoint is available) # Introducing a delay (ensure that gateway endpoint is available)
time.sleep(5) time.sleep(10)
# Constructing the subscription information for the push notification # Constructing the subscription information for the push notification
subscription_info = { subscription_info = {
@ -312,7 +312,7 @@ class WebPushService():
message = {"title": "Subscription Successful", "message": "Thank you for subscribing!"} message = {"title": "Subscription Successful", "message": "Thank you for subscribing!"}
# Sending the confirmation push notification # Sending the confirmation push notification
success = WebPushService_send_push_notification(subscription_info, message, vapid_key) success = WebPushService._send_push_notification(subscription_info, message, vapid_key)
# Returning the operation status # Returning the operation status
return jsonify(success=success) return jsonify(success=success)

Loading…
Cancel
Save