summaryrefslogtreecommitdiff
path: root/backend/notif.py
diff options
context:
space:
mode:
Diffstat (limited to 'backend/notif.py')
-rw-r--r--backend/notif.py9
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 (