mirror of
https://github.com/tcsenpai/pensieve.git
synced 2025-06-06 19:25:24 +00:00
22 lines
541 B
Python
22 lines
541 B
Python
import os
|
|
from pathlib import Path
|
|
from pydantic_settings import BaseSettings, SettingsConfigDict
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
model_config = SettingsConfigDict(env_prefix="MEMOS_")
|
|
|
|
base_dir: str = str(Path.home() / ".memos")
|
|
database_path: str = os.path.join(base_dir, "database.db")
|
|
|
|
|
|
settings = Settings()
|
|
|
|
# Define the default database path
|
|
os.makedirs(settings.base_dir, exist_ok=True)
|
|
|
|
|
|
# Function to get the database path from environment variable or default
|
|
def get_database_path():
|
|
return settings.database_path
|