diff --git a/src/api/view.py b/src/api/view.py index e23e804..36e67fe 100644 --- a/src/api/view.py +++ b/src/api/view.py @@ -6,6 +6,7 @@ # @File Name: view.py +import os import time from src.api import api from src.db import Database @@ -52,6 +53,8 @@ async def query_all(limit: int = 30): @api.get('/export') async def export(): + if os.path.exists('/tmp/data.sqlite'): + return FileResponse('/tmp/data.sqlite') return FileResponse('./src/db/data.sqlite') diff --git a/src/config.py b/src/config.py index 311c225..46ab4ee 100644 --- a/src/config.py +++ b/src/config.py @@ -13,5 +13,5 @@ class Config: sqlite3 -> sqlite3 (default) mysql -> user:pwd@host:port/db """ - database = os.getenv('COUNTER_DB') or "sqlite3" # Database type + database = os.getenv('COUNTER_DB') or "root:123@gd.dgtmc.top:3306/" # Database type DETA = False if not os.getenv('DETA_RUNTIME') else True # mark deta