diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-12-30 00:00:50 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-12-30 00:00:50 +0800 |
| commit | 68842e3654895fd1abd565445de82b7248280f31 (patch) | |
| tree | ec0ba7e153d6db5f6631e375e32d44fe35b7de23 | |
| parent | 39108aace0736ec676875e36e40024e56b665daa (diff) | |
actual vapid key
| -rw-r--r-- | backend/notif.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/backend/notif.py b/backend/notif.py index 8fe0df3..15977a0 100644 --- a/backend/notif.py +++ b/backend/notif.py @@ -1,7 +1,8 @@ from pydantic import BaseModel import sqlite3 from pywebpush import webpush - +from dotenv import load_dotenv +from os import getenv class PushSubscriptionData(BaseModel): endpoint: str @@ -11,9 +12,9 @@ class PushSubscriptionData(BaseModel): conn = sqlite3.connect("db.db", check_same_thread=False) cursor = conn.cursor() -f = open("private_key.pem", "r") -PRIVATE_VAPID_KEY = f.read() -f.close() +load_dotenv() + +PRIVATE_VAPID_KEY = getenv("PRIVATE_VAPID_KEY") cursor.execute(""" CREATE TABLE IF NOT EXISTS subscriptions ( |
