This commit is contained in:
Cyberes 2024-03-06 14:28:20 -07:00
parent 94aadf1246
commit a9d6ef6783
2 changed files with 7 additions and 2 deletions

View File

@ -2,4 +2,5 @@ pyyaml==6.0.1
chardet==5.2.0 chardet==5.2.0
humanize==4.9.0 humanize==4.9.0
mmh3==4.1.0 mmh3==4.1.0
flask==3.0.2 flask==3.0.2
python-magic==0.4.27

View File

@ -1,4 +1,5 @@
import json import json
import os
import sqlite3 import sqlite3
from datetime import datetime from datetime import datetime
from pathlib import Path from pathlib import Path
@ -8,9 +9,12 @@ from flask import Flask, render_template, send_from_directory
app = Flask(__name__) app = Flask(__name__)
if not os.environ.get('SQLITE3_DB'):
raise Exception('SQLITE3_DB not set.')
def get_db_connection(): def get_db_connection():
conn = sqlite3.connect('emails.db') conn = sqlite3.connect(os.environ.get('SQLITE3_DB'))
conn.row_factory = sqlite3.Row conn.row_factory = sqlite3.Row
return conn return conn