feat(studio): add auth-specific paths and integrate auth database location

This commit is contained in:
Shine1i 2026-03-09 20:15:10 +01:00 committed by Manan17
commit f2b2b33769
3 changed files with 16 additions and 3 deletions

View file

@ -7,10 +7,11 @@ SQLite storage for authentication data (user credentials + JWT secret).
import hashlib
import sqlite3
from datetime import datetime, timezone
from pathlib import Path
from typing import Optional, Tuple
DB_PATH = Path(__file__).parent / "auth.db"
from utils.paths import auth_db_path, ensure_dir
DB_PATH = auth_db_path()
def _hash_token(token: str) -> str:
@ -20,6 +21,7 @@ def _hash_token(token: str) -> str:
def get_connection() -> sqlite3.Connection:
"""Get a connection to the auth database, creating tables if needed."""
ensure_dir(DB_PATH.parent)
conn = sqlite3.connect(DB_PATH)
conn.row_factory = sqlite3.Row
conn.execute(
@ -256,4 +258,3 @@ def revoke_user_refresh_tokens(username: str) -> None:
conn.commit()
finally:
conn.close()