Add configurable database path via environment variables
- Add DATABASE_PATH environment variable support in app.py and aerich_config.py - DATABASE_PATH: For simple relative/absolute paths (default: database/raggr.db) - DATABASE_URL: For full connection strings (overrides DATABASE_PATH if set) - Create .env.example with all configuration options documented - Maintains backward compatibility with default database location Usage: # Use default path python app.py # Use custom path for development DATABASE_PATH=dev.db python app.py # Use full connection string DATABASE_URL=sqlite://custom/path.db python app.py 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
5
app.py
5
app.py
@@ -26,8 +26,11 @@ app.register_blueprint(blueprints.users.user_blueprint)
|
||||
app.register_blueprint(blueprints.conversation.conversation_blueprint)
|
||||
|
||||
|
||||
# Database configuration with environment variable support
|
||||
DATABASE_PATH = os.getenv("DATABASE_PATH", "database/raggr.db")
|
||||
|
||||
TORTOISE_CONFIG = {
|
||||
"connections": {"default": "sqlite://database/raggr.db"},
|
||||
"connections": {"default": f"sqlite://{DATABASE_PATH}"},
|
||||
"apps": {
|
||||
"models": {
|
||||
"models": [
|
||||
|
||||
Reference in New Issue
Block a user